| fit_acd | R Documentation |
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).
fit_acd(x, powers = NULL, shift = 0, scale = 1)
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 |
Briefly, the estimation works as follows. First, the input data are shifted to positive values and scaled as requested. Then
z = \Phi^{-1}(\frac{rank(x) - 0.5}{n})
is computed, where n is the number of elements in x,
with ties in the ranks handled as averages. To approximate z,
an FP1 model (least squares) is used, i.e.
E(z) = \beta_0 + \beta_1 (x)^p, where p is chosen such that it
provides the best fitting model among all possible FP1 models.
The ACD transformation is then given as
acd(x) = \Phi(\hat{z}),
where the fitted values of the estimated model are used.
If the relationship between a response Y and acd(x) is linear,
say, E(Y) = \beta_0 + \beta_1 acd(x), the relationship between Y
and x is nonlinear and is typically sigmoid in shape.
The parameters \beta_0 and \beta_0 + \beta_1 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 \beta_1 represents the range of predictions of E(Y)
across the whole observed distribution of x (Royston 2014).
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.
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.
set.seed(42)
x = apply_shift_scale(rnorm(100))
y = rnorm(100)
fit_acd(x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.