fix.crossing: Fixing a Quantile Regression having Crossing

Description Usage Arguments Details Value See Also Examples

Description

Returns a similar object fitted with columns of the constraint matrices amalgamated so it is a partially parallel VGLM object. The columns combined correspond to certain crossing quantiles. This applies especially to an extlogF1() VGLM object.

Usage

1
fix.crossing.vglm(object, maxit = 100, trace = FALSE, ...)

Arguments

object

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

maxit, trace

values for overwriting components in vglm.control. Setting these to NULL will mean the values in vglm.control on object will be retained.

...

additional optional arguments. Currently unused.

Details

The quantile crossing problem has been described as disturbing and embarrassing. This function was specifically written for a vglm with family function extlogF1. It examines the fitted quantiles of object to see if any cross. If so, then a pair of columns is combined to make those two quantiles parallel. After fitting the submodel it then repeats testing for crossing quantiles and repairing them, until there is no more quantile crossing detected. Note that it is possible that the quantiles cross in some subset of the covariate space not covered by the data—see is.crossing.

This function is fragile and likely to change in the future. For extlogF1 models, it is assumed that argument data has been assigned a data frame, and that the default values of the argument parallel has been used; this means that the second constraint matrix is diag(M). The constraint matrix of the intercept term remains unchanged as diag(M).

Value

An object very similar to the original object, but with possibly different constraint matrices (partially parallel) so as to remove any quantile crossing.

See Also

extlogF1, is.crossing, lms.bcn. vglm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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")
fix.crossing(fit1)
matlines(with(bmi.nz, age), fitted(fit1), lty = 1, col = "orange")
fit2 <- fix.crossing(fit1)  # Some quantiles have been fixed
constraints(fit2)
matlines(with(bmi.nz, age), fitted(fit2), lty = "dashed",
         col = "darkgreen", lwd = 2)  
## End(Not run)

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.