deplot.lmscreg {VGAM} | R Documentation

## Density Plot for LMS Quantile Regression

### Description

Plots a probability density function associated with a LMS quantile regression.

### Usage

    deplot.lmscreg(object, newdata = NULL,
                   x0, y.arg, plot.it = TRUE, ...)

### Arguments

`object` | A VGAM quantile regression model, i.e., an object produced by modelling functions such as `vglm` and `vgam` with a family function beginning with `"lms."`, e.g., `lms.yjn`.
`newdata` | Optional data frame containing secondary variables such as sex. It should have a maximum of one row. The default is to use the original data.
`x0` | Numeric. The value of the primary variable at which to make the `slice'.
`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.
`plot.it` | Logical. Plot it? If `FALSE` no plot will be done.
`...` | Graphical parameter that are passed into `plotdeplot.lmscreg`.

### Details

This function calls, e.g., `deplot.lms.yjn` in order to compute the density function.

### Value

The original `object` but with a list placed in the slot `post`, called `@post$deplot`. The list has components

`newdata` | The argument `newdata` above, or a one-row data frame constructed out of the `x0` argument.
`y` | The argument `y.arg` above.
`density` | Vector of the density function values evaluated at `y.arg`.

### Note

`plotdeplot.lmscreg` actually does the plotting.

### Author(s)

Thomas W. Yee

### References

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

`plotdeplot.lmscreg`, `qtplot.lmscreg`, `lms.bcn`, `lms.bcg`, `lms.yjn`.

### Examples

    ## Not run:
    fit = vgam(BMI ~ s(age, df=c(4,2)), fam=lms.bcn(zero=1), data=bminz)
    ygrid = seq(15, 43, by=0.25)
    deplot(fit, x0=20, y=ygrid, xlab="BMI", col="green", llwd=2,
           main="BMI distribution at ages 20 (green), 40 (blue), 60 (red)")
    deplot(fit, x0=40, y=ygrid, add=TRUE, col="blue", llwd=2)
    deplot(fit, x0=60, y=ygrid, add=TRUE, col="red", llwd=2) -> a

    names(a@post$deplot)
    a@post$deplot$newdata
    head(a@post$deplot$y)
    head(a@post$deplot$density)
    ## End(Not run)

[Package VGAM version 0.7-9 Index]