Computes the cumulative distribution function (CDF) for observations, based on a LMS quantile regression.

cdf.lmscreg(object, newdata = NULL, ...)

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

newdata

Data frame where the predictions are to be made. If missing, the original data is used.

...

Parameters which are passed into functions such as cdf.lms.yjn.

Details

The CDFs returned here are values lying in [0,1] giving the relative probabilities associated with the quantiles newdata. For example, a value near 0.75 means it is close to the upper quartile of the distribution.

Value

A vector of CDF values lying in [0,1].

References

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

Author

Thomas W. Yee

Note

The data are treated like quantiles, and the percentiles are returned. The opposite is performed by qtplot.lmscreg.

The CDF values of the model have been placed in @post$cdf when the model was fitted.

Examples

fit <- vgam(BMI ~ s(age, df=c(4, 2)), lms.bcn(zero = 1), data = 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
head(fit@post$cdf)
#>         1         2         3         4         5         6 
#> 0.2280309 0.6365499 0.6356761 0.4321450 0.4321311 0.9686738 
head(cdf(fit))  # Same
#>         1         2         3         4         5         6 
#> 0.2280309 0.6365499 0.6356761 0.4321450 0.4321311 0.9686738 
head(depvar(fit))
#>       [,1]
#> 1 22.77107
#> 2 27.70033
#> 3 28.18127
#> 4 25.08380
#> 5 26.46388
#> 6 36.19648
head(fitted(fit))
#>        25%      50%      75%
#> 1 23.00836 25.48922 28.44767
#> 2 23.65211 26.19783 29.23269
#> 3 24.07328 26.66334 29.75085
#> 4 23.25503 25.75937 28.74518
#> 5 24.53531 27.17650 30.32525
#> 6 23.63164 26.17517 29.20742

cdf(fit, data.frame(age = c(31.5, 39), BMI = c(28.4, 24)))
#>         1         2 
#> 0.7469759 0.2861046