Fit a joint multi-tau mixture of quantile regressions (non-crossing, shared labels)
Source:R/noncrossing.R
mixqr_nc.RdEstimates a finite mixture of quantile regressions at a vector of quantile
levels tau jointly, with one latent classification shared across all levels
(a coupled E-step that pools the per-level component likelihoods) and
guaranteed non-crossing of the within-component quantile curves. This closes
the two problems Wu & Yao (2016, sec.5) leave open: within-component crossing
and cross-tau classification ambiguity.
Usage
mixqr_nc(
formula,
data,
m = 2L,
tau = c(0.25, 0.5, 0.75),
noncrossing = c("rearrange", "none"),
class_coupling = c("pool", "median"),
nstart = 10L,
control = mixqr_control(),
weights = NULL
)Arguments
- formula, data, m, nstart, control, weights
As in
mixqr().- tau
Increasing vector of quantile levels (length >= 2).
- noncrossing
"rearrange"(default; monotone-rearrange the fitted per-tau quantiles within each component, Chernozhukov et al. 2010) or"none"(legacy per-tau fits, which may cross – for diagnosis/comparison).- class_coupling
How the shared E-step pools over
tau:"pool"(default; geometric mean, weights1/L) or"median"(classify on the median level only).
Value
An object of class c("mixqr_multitau", "mixqr") with a coefficient
array coefficients ([p+1, m, L]), the shared posterior/classification,
mix_prop, the tau grid, and a crossing diagnostic (raw crossings, 0
after rearrangement).
References
Wu, Q. and Yao, W. (2016). Mixtures of quantile regressions. CSDA 93, 162–176. Chernozhukov, V., Fernandez-Val, I. and Galichon, A. (2010). Quantile and probability curves without crossing. Econometrica 78, 1093–1125.
Examples
# \donttest{
d <- sim_mixqr_cross(n = 160, seed = 1)
fit <- mixqr_nc(y ~ x, data = d, m = 2, tau = c(0.1, 0.25, 0.5, 0.75, 0.9))
fit$crossing # raw crossings -> 0 after rearrangement
#> $raw
#> [1] 4
#>
#> $after
#> [1] 0
#>
#> $method
#> [1] "rearrange"
#>
predict(fit)[1, , ] # non-crossing quantiles for observation 1
#> tau0.1 tau0.25 tau0.5 tau0.75 tau0.9
#> [1,] -4.2533230 -3.4859573 -1.9496616 -0.04859789 1.3461069
#> [2,] -0.9219902 -0.6912938 -0.2959845 0.09807378 0.3183975
# }