is.crossing: Quantile Crossing Detection

is.crossingR Documentation

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, ...)

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.

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.

See Also

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

Examples

## Not run:  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") 
## End(Not run)

VGAM documentation built on Sept. 18, 2024, 9:09 a.m.