fix.crossing: Fixing a Quantile Regression having Crossing

fix.crossingR Documentation

Fixing a Quantile Regression having Crossing


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.


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



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.


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


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


## Not run:  ooo <- with(, order(age)) <-[ooo, ]  # Sort by age
with(, 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),, trace = TRUE)
plot(BMI ~ age,, col = "blue", las = 1,
     main = "Partially parallel (darkgreen) & nonparallel quantiles",
     sub = "Crossing quantiles are orange")
matlines(with(, age), fitted(fit1), lty = 1, col = "orange")
fit2 <- fix.crossing(fit1)  # Some quantiles have been fixed
matlines(with(, age), fitted(fit2), lty = "dashed",
         col = "darkgreen", lwd = 2)  
## End(Not run)

VGAM documentation built on July 6, 2022, 5:05 p.m.