scaleTR {cdfquantreg} | R Documentation |
Transform Values into (0, 1) Interval
Description
scaleTR
is function that rescales values of a variable into the (0, 1) interval.
Usage
scaleTR(y, high = NULL, low = NULL, data = NULL, N = NULL, scale = 0.5)
Arguments
y |
A numeric vector, or a variable in a dataframe. |
high |
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. |
low |
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. |
data |
A dataframe that contains the variable y. |
N |
A integer, normally is the sample size or the number of values. If not supplied, the length of y will be used. |
scale |
A compressing parameter that determines the extend to which the boundary values are going to be pushed away from the boundary. See details. |
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.
See Also
Examples
y <- rnorm(20, 0, 1)
ynew <- scaleTR(y)