scaleTR
is function that rescales values of a variable into the (0, 1) interval.
scaleTR(y, high = NULL, low = NULL, data = NULL, N = NULL, scale = 0.5)
A numeric vector, or a variable in a dataframe.
The highest possible value of that variable. The value should be equal or greater than the maximum value of y. If not supplied, the maximum value of y will be used.
The lowest possible value of that variable. The value should be equal or smaller than the minimum value of y. If not supplied, the minimum value of y will be used.
A dataframe that contains the variable y.
A integer, normally is the sample size or the number of values. If not supplied, the length of y will be used.
A compressing parameter that determines the extend to which the boundary values are going to be pushed away from the boundary. See details.
scaleTR
used the method suggested by Smithson and Verkuilen (2006) and applies linear transformation to values into the open interval (0, 1). It first transform the values from their original scale by taking \(y' = (y - a)/(b-a)\), where a
is the lowest possible value of that variable and b
is the highest possible value of that variable. Next, it compresses the range to avoid zeros and ones by taking \(y" = (y'(N - 1) + c)/N\), where N
is the sample size and c
is the compressing parameter. The smaller value c
is, the boundary values would be more approaching zeros and ones, and have greater impact on the estimation of the dispersion parameters in the cdf quantile model.
cdfquantreg
y <- rnorm(20, 0, 1)
ynew <- scaleTR(y)
Run the code above in your browser using DataLab