is.crossing | R Documentation |
Returns a logical from testing whether an object such as an extlogF1() VGLM object has crossing quantiles.
is.crossing.vglm(object, ...)
object |
an object such as
a |
... |
additional optional arguments. Currently unused. |
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.
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
.
extlogF1
,
fix.crossing
,
lms.bcn
.
vglm
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.