
Last chance! 50% off unlimited learning
Sale ends in
lms.bcg(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)
"vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
rrvglm
and vgam
.maxits
to be the iteration
number corresponding to the highest likelihood value.
See the example below.The expected value of the second derivative with respect to lambda may be incorrect (my calculations do not agree with the Lopatatzidis and Green manuscript.)
Yee, T. W. (2004) Quantile regression via vector generalized additive models. Statistics in Medicine, 23, 2295--2315.
Documentation accompanying the
lms.bcn
,
lms.yjn
,
qtplot.lmscreg
,
deplot.lmscreg
,
cdf.lmscreg
,
bminz
.data(bminz)
# This converges, but can't be deplot()'ed or qtplot()'ed
fit = vglm(BMI ~ bs(age, df=4), fam=lms.bcg(zero=c(1,3)), data=bminz, tr=TRUE)
coef(fit, matrix=TRUE)
par(mfrow=c(1,1))
plotvgam(fit, se=TRUE) # Plot mu function (only)
# Difficult to get a model that converges
# Here, we prematurely stop iterations because it fails near the solution
fit = vgam(BMI ~ s(age, df=c(4,2)), maxit=4,
fam=lms.bcg(zero=1, init.lam=3), data=bminz, tr=TRUE)
summary(fit)
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