Learn R Programming

VGAM (version 1.1-8)

is.crossing: Quantile Crossing Detection

Description

Returns a logical from testing whether an object such as an extlogF1() VGLM object has crossing quantiles.

Usage

is.crossing.vglm(object, ...)

Value

A logical. If TRUE then one can try fit a similar model by combining columns of the constraint matrices so that crossing no longer holds; see fix.crossing. For LMS-Box-Cox type quantile regression models it is impossible for the quantiles to cross, by definition, hence FALSE is returned; see lms.bcn.

Arguments

object

an object such as a vglm object with family function extlogF1.

...

additional optional arguments. Currently unused.

Details

This function was specifically written for a vglm with family function extlogF1. It examines the fitted quantiles to see if any cross. Note that if one uses regression splines such as bs and ns then it is possible that they cross at values of the covariate space that are not represented by actual data. One could use linear interpolation between fitted values to get around this problem.

See Also

extlogF1, fix.crossing, lms.bcn. vglm.

Examples

Run this code
if (FALSE)  ooo <- with(bmi.nz, order(age))
bmi.nz <- bmi.nz[ooo, ]  # Sort by age
with(bmi.nz, plot(age, BMI, col = "blue"))
mytau <- c(50, 93, 95, 97) / 100  # Some quantiles are quite close
fit1 <- vglm(BMI ~ ns(age, 7), extlogF1(mytau), bmi.nz, trace = TRUE)
plot(BMI ~ age, bmi.nz, col = "blue", las = 1,
     main = "Partially parallel (darkgreen) & nonparallel quantiles",
     sub = "Crossing quantiles are orange")
is.crossing(fit1)
matlines(with(bmi.nz, age), fitted(fit1), lty = 1, col = "orange") 

Run the code above in your browser using DataLab