fit_acd {mfp2} | R Documentation |
Function to estimate approximate cumulative distribution (ACD)
Description
Fits ACD transformation as outlined in Royston (2014). The ACD transformation smoothly maps the observed distribution of a continuous covariate x onto one scale, namely, that of an approximate uniform distribution on the interval (0, 1).
Usage
fit_acd(x, powers = NULL, shift = 0, scale = 1)
Arguments
x |
a numeric vector. |
powers |
a vector of allowed FP powers. The default value is |
shift |
a numeric that is used to shift the values of |
scale |
a numeric used to scale |
Details
Briefly, the estimation works as follows. First, the input data are shifted to positive values and scaled as requested. Then
is computed, where is the number of elements in
x
,
with ties in the ranks handled as averages. To approximate ,
an FP1 model (least squares) is used, i.e.
, where
is chosen such that it
provides the best fitting model among all possible FP1 models.
The ACD transformation is then given as
where the fitted values of the estimated model are used.
If the relationship between a response Y and acd(x) is linear,
say, , the relationship between Y
and x is nonlinear and is typically sigmoid in shape.
The parameters
and
in such a model are
interpreted as the expected values of Y at the minimum and maximum of x,
that is, at acd(x) = 0 and 1, respectively.
The parameter
represents the range of predictions of
across the whole observed distribution of x (Royston 2014).
Value
A list is returned with components
-
acd
: the acd transformed input data. -
beta0
: intercept of estimated model. -
beta1
: coefficient of estimated model. -
power
: estimated power. -
shift
: shift value used for computations. -
scale
: scaling factor used for computations.
References
Royston, P. and Sauerbrei, W. (2016). mfpa: Extension of mfp using the ACD covariate transformation for enhanced parametric multivariable modeling. The Stata Journal, 16(1), pp.72-87.
Royston, P. (2014). A smooth covariate rank transformation for use in regression models with a sigmoid dose–response function. The Stata Journal, 14(2), 329-341.
Examples
set.seed(42)
x = apply_shift_scale(rnorm(100))
y = rnorm(100)
fit_acd(x, y)