fit_acd: Function to estimate approximate cumulative distribution...

View source: R/acd.R

fit_acdR 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 NULL, meaning that the set S = (-2, -1, -0.5, 0, 0.5, 1, 2, 3) is used.

shift

a numeric that is used to shift the values of x to positive values. The default value is 0, meaning no shifting is conducted. If NULL, then the program will estimate an appropriate shift automatically (see find_shift_factor()).

scale

a numeric used to scale x. The default value is 1, meaning no scaling is conducted. If NULL, then the program will estimate an appropriate scaling factor automatically (see find_scale_factor()).

Details

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).

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)


mfp2 documentation built on Nov. 15, 2023, 1:06 a.m.