Learn R Programming

VGAM (version 0.7-5)

lms.bcn: LMS Quantile Regression with a Box-Cox Transformation to Normality

Description

LMS quantile regression with the Box-Cox transformation to normality.

Usage

lms.bcn(percentiles = c(25, 50, 75), zero = NULL, 
        link.mu="identity", link.sigma = "loge",
        emu=list(), esigma=list(),
        dfmu.init=4, dfsigma.init=2,
        init.lambda = 1, init.sigma = NULL)

Arguments

percentiles
A numerical vector containing values between 0 and 100, which are the quantiles. They will be returned as `fitted values'.
zero
An integer-valued vector specifying which linear/additive predictors are modelled as intercepts only. The values must be from the set {1,2,3}. The default value, NULL, means they all are functions of the covariates.
link.mu
Parameter link function applied to the second linear/additive predictor. See Links for more choices.
link.sigma
Parameter link function applied to the third linear/additive predictor. See Links for more choices.
emu, esigma
List. Extra argument for each of the links. See earg in Links for general information.
dfmu.init
Degrees of freedom for the cubic smoothing spline fit applied to get an initial estimate of mu. See vsmooth.spline.
dfsigma.init
Degrees of freedom for the cubic smoothing spline fit applied to get an initial estimate of sigma. See vsmooth.spline. This argument may be assigned NULL to get an initial value
init.lambda
Initial value for lambda. If necessary, it is recycled to be a vector of length $n$.
init.sigma
Optional initial value for sigma. If necessary, it is recycled to be a vector of length $n$. The default value, NULL, means an initial value is computed in the @initialize slot of the family function.

Value

Warning

The computations are not simple, therefore convergence may fail. In that case, try different starting values. Also, the estimate may diverge quickly near the solution, in which case try prematurely stopping the iterations by assigning maxits to be the iteration number corresponding to the highest likelihood value.

Details

Given a value of the covariate, this function applies a Box-Cox transformation to the response to best obtain normality. The parameters chosen to do this are estimated by maximum likelihood or penalized maximum likelihood.

References

Cole, T. J. and Green, P. J. (1992) Smoothing Reference Centile Curves: The LMS Method and Penalized Likelihood. Statistics in Medicine, 11, 1305--1319.

Yee, T. W. (2004) Quantile regression via vector generalized additive models. Statistics in Medicine, 23, 2295--2315.

Documentation accompanying the VGAM package at http://www.stat.auckland.ac.nz/~yee contains further information and examples.

See Also

lms.bcg, lms.yjn, qtplot.lmscreg, deplot.lmscreg, cdf.lmscreg, bminz, alsqreg.

Examples

Run this code
data(bminz)
fit = vgam(BMI ~ s(age, df=c(4,2)), fam=lms.bcn(zero=1), data=bminz, tr=TRUE)
predict(fit)[1:3,]
fitted(fit)[1:3,]
bminz[1:3,]
# Person 1 is near the lower quartile of BMI amongst people his age
cdf(fit)[1:3]

# Quantile plot
par(bty="l", mar=c(5,4,4,3)+0.1, xpd=TRUE)
qtplot(fit, percentiles=c(5,50,90,99), main="Quantiles",
       xlim=c(15,90), las=1, ylab="BMI", lwd=2, lcol=4)

# Density plot
ygrid = seq(15, 43, len=100)  # BMI ranges
par(mfrow=c(1,1), lwd=2)
a = deplot(fit, x0=20, y=ygrid, xlab="BMI", col="black",
    main="Density functions at Age = 20 (black), 42 (red) and 55 (blue)")
a
a = deplot(fit, x0=42, y=ygrid, add=TRUE, llty=2, col="red")
a = deplot(fit, x0=55, y=ygrid, add=TRUE, llty=4, col="blue", Attach=TRUE)
a@post$deplot  # Contains density function values

Run the code above in your browser using DataLab