An extensible expectation-maximization (EM) framework for finite
mixtures of quantile regressions (clusterwise / mixture-of-experts quantile
regression). A single EM substrate with an engine/extension contract carries
a family of capabilities: the core free-weight mixture of Wu and Yao (2016)
mixqr is an extensible framework for finite mixtures of quantile (and
expectile) regressions in R. At its heart it finds hidden subgroups in your data
and fits a separate quantile regression in each one: when a single regression
line hides two (or more) distinct relationships (a high-return group and a
low-return group, a fast-growing segment and a stagnant one), mixqr recovers
the groups and their group-specific effects at once, without you having to
label the groups in advance. Because it models a quantile rather than the
mean, it is robust to skew and outliers and can describe effects in the tails as
well as at the center.
Built on a single expectation–maximization (EM) substrate with a documented engine/extension contract, the package grows that core into a family of capabilities — expectile and M-quantile component families, component-specific penalized selection, and joint multi-quantile estimation with non-crossing — and the companion package mixqrgate adds location-varying gating.
The package fills a real gap in the R ecosystem. The only previous CRAN package
for this model (qrmix) was archived in 2026 and used a heuristic, not the
likelihood-and-EM estimator; ClusPred solves a different (covariate-driven
latent-class) problem; flexmix and mixtools have no quantile / check-loss
driver; and brms's mixture(asym_laplace) cannot give the constrained,
location-anchored components or the calibrated standard errors that inference
requires. mixqr provides a clean, quantile-first interface, the first
maintained implementation of the Wu & Yao (2016) kernel-density EM, and
standard errors validated by simulation to reach near-nominal coverage.
📖 Full documentation and tutorial: https://kvenkita.github.io/mixqr/
# install.packages("remotes")
remotes::install_github("kvenkita/mixqr")
mixqr is pure R — no compiler or Stan toolchain required.
library(mixqr)
# Two combustion regimes in the engine (ethanol) data
fit <- mixqr(equivalence ~ nox, data = engine, tau = 0.5, m = 2,
variance = "stochEM")
summary(fit) # component coefficients with calibrated standard errors
plot(fit) # data + component lines, and the error densities
predict(fit, type = "class") # which regime each observation belongs to
# Choose the number of components
mixqr_select(equivalence ~ nox, data = engine, tau = 0.5, m = 1:4,
criterion = "cv")
AIC/BIC (the default), and the
semiparametric kernel-density EM of Wu & Yao (2016) with nonparametric
component error densities (robust to multimodal / asymmetric errors).summary(), coef(),
confint(), vcov(), predict(), plot(), AIC()/BIC() methods.family =). Smooth, crossing-free
component losses (Newey & Powell 1987; Breckling & Chambers 1988) beside the
quantile check loss.mixqr_pen()). SCAD / adaptive-LASSO
selection in which each latent regime gets its own sparse support.mixqr_nc()). Joint estimation across a
grid of quantiles with one shared classification and order-respecting curves.register_mixqr_engine()) hosts
all of the above, and the companion mixqrgate adds location-varying gating.| Function | Purpose |
|---|---|
mixqr() |
Fit a finite mixture of quantile regressions |
mixqr_control(), mixqr_vcontrol() |
EM and variance-estimation settings |
mixqr_select() |
Choose the number of components (AIC / BIC / CV) |
mixqr(family = ) |
Quantile, expectile or M-quantile component losses |
mixqr_pen(), selectedVars() |
Component-specific penalized variable selection |
mixqr_nc() |
Joint multi-quantile fit: shared classification + non-crossing |
summary(), coef(), confint() |
Component estimates, SEs and intervals |
predict() |
Component quantiles, classification, posteriors |
plot() |
Data + component lines and error densities |
sim_mixqr2(), sim_mixqr3() |
Reproducible Wu & Yao simulation designs |
If you use mixqr, please cite it:
Venkitasubramanian, K. (2026). mixqr: Extensible Finite Mixtures of Quantile and Expectile Regressions. R package version 0.2.0. https://github.com/kvenkita/mixqr
citation("mixqr")
Please also cite the underlying methodology — Wu & Yao (2016) for the mixture-of-quantile-regressions estimator, and Koenker & Bassett (1978) for quantile regression.
Created and maintained by Kailas Venkitasubramanian, University of North Carolina at Charlotte. Released under the MIT License.