Density Plot for LMS Quantile Regression
plotdeplot.lmscreg.RdPlots a probability density function associated with a LMS quantile regression.
Arguments
- answer
Output from functions of the form
deplot.???where???is the name of the VGAM LMS family function, e.g.,lms.yjn. See below for details.- y.arg
Numerical vector. The values of the response variable at which to evaluate the density. This should be a grid that is fine enough to ensure the plotted curves are smooth.
- add.arg
Logical. Add the density to an existing plot?
- xlab, ylab
Caption for the x- and y-axes. See
par.- xlim, ylim
Limits of the x- and y-axes. See
par.- llty.arg
Line type. See the
ltyargument ofpar.- col.arg
Line color. See the
colargument ofpar.- llwd.arg
Line width. See the
lwdargument ofpar.- ...
Arguments passed into the
plotfunction when setting up the entire plot. Useful arguments here includemainandlas.
Value
The list answer, which has components
- newdata
The argument
newdataabove from the argument list ofdeplot.lmscreg, or a one-row data frame constructed out of thex0argument.- y
The argument
y.argabove.- density
Vector of the density function values evaluated at
y.arg.
References
Yee, T. W. (2004). Quantile regression via vector generalized additive models. Statistics in Medicine, 23, 2295–2315.
Note
While the graphical arguments of this function are useful to the user, this function should not be called directly.
Examples
fit <- vgam(BMI ~ s(age, df = c(4,2)), lms.bcn(zero = 1), bmi.nz)
#> VGAM s.vam loop 1 : loglikelihood = -6429.7568
#> VGAM s.vam loop 2 : loglikelihood = -6327.3502
#> VGAM s.vam loop 3 : loglikelihood = -6313.2224
#> VGAM s.vam loop 4 : loglikelihood = -6312.8069
#> VGAM s.vam loop 5 : loglikelihood = -6312.8166
#> VGAM s.vam loop 6 : loglikelihood = -6312.8032
#> VGAM s.vam loop 7 : loglikelihood = -6312.8088
#> VGAM s.vam loop 8 : loglikelihood = -6312.8062
#> VGAM s.vam loop 9 : loglikelihood = -6312.8074
#> VGAM s.vam loop 10 : loglikelihood = -6312.8068
#> VGAM s.vam loop 11 : loglikelihood = -6312.8071
#> VGAM s.vam loop 12 : loglikelihood = -6312.807
if (FALSE) y = seq(15, 43, by = 0.25)
deplot(fit, x0 = 20, y = y, xlab = "BMI", col = "green", llwd = 2,
main = "BMI distribution at ages 20 (green), 40 (blue), 60 (orange)")
#> Error: object 'y' not found
deplot(fit, x0 = 40, y = y, add = TRUE, col = "blue", llwd = 2)
#> Error: object 'y' not found
deplot(fit, x0 = 60, y = y, add = TRUE, col = "orange", llwd = 2) -> aa
#> Error: object 'y' not found
names(aa@post$deplot)
#> Error: object 'aa' not found
aa@post$deplot$newdata
#> Error: object 'aa' not found
head(aa@post$deplot$y)
#> Error: object 'aa' not found
head(aa@post$deplot$density) # \dontrun{}
#> Error: object 'aa' not found