| Title: | Location-Varying Gating for Mixtures of Quantile Regressions |
|---|---|
| Description: | Extends finite mixtures of quantile regressions (the 'mixqr' package) with a concomitant-covariate, quantile-indexed mixing gate. The mixing probabilities follow a multinomial-logit model whose coefficients may depend on a separate set of gating covariates and on the quantile level, so that latent-class membership can change across the conditional distribution. This turns the location-varying mixing idea of Furno (2025) into a likelihood and EM object with proper standard errors on the gate. Estimation reuses the 'mixqr' component and error-density machinery; the gate is fit by a weighted multinomial-logistic M-step and reduces exactly to a constant gate when the gating model is an intercept only. |
| Authors: | Kailas Venkitasubramanian [aut, cre, cph] |
| Maintainer: | Kailas Venkitasubramanian <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.2 |
| Built: | 2026-07-17 07:50:25 UTC |
| Source: | https://github.com/kvenkita/mixqrgate |
Confidence intervals for the gate coefficients
## S3 method for class 'mixqrgate' confint(object, parm, level = 0.95, tau = NULL, ...)## S3 method for class 'mixqrgate' confint(object, parm, level = 0.95, tau = NULL, ...)
object |
A |
parm |
Ignored; intervals are returned for all gate coefficients. |
level |
Confidence level. |
tau |
Quantile level at which to report the (location-varying) gate; defaults to the first grid point. |
... |
Unused. |
A matrix of lower/upper limits for the gate coefficients.
Fits a finite mixture of tau-quantile regressions whose mixing probabilities follow a multinomial-logit gate on concomitant covariates, optionally indexed by the quantile level. The gate turns the location-varying mixing of Furno (2025) into a likelihood/EM object with standard errors.
mixqrgate( formula, data, gating = ~1, G = 2L, tau = 0.5, vary_gating = c("none", "discrete"), method = c("ald", "kde"), variance = c("sandwich", "louis", "stochEM"), gate_B = 200L, control = mixqrgate_control() )mixqrgate( formula, data, gating = ~1, G = 2L, tau = 0.5, vary_gating = c("none", "discrete"), method = c("ald", "kde"), variance = c("sandwich", "louis", "stochEM"), gate_B = 200L, control = mixqrgate_control() )
formula |
Component model, |
data |
A data frame. |
gating |
One-sided concomitant gate formula in the gating covariates;
|
G |
Number of components. Default |
tau |
Quantile level(s) in (0, 1). A vector triggers a location-varying (per-tau) gate. |
vary_gating |
|
method |
|
variance |
Gate standard errors. |
gate_B |
Number of imputations for |
control |
A |
An object of class "mixqrgate".
Furno, M. (2025). Finite Mixture at Quantiles and Expectiles. JRFM 18(4), 177.
set.seed(1) d <- sim_gate2(n = 300) fit <- mixqrgate(y ~ x, data = d, gating = ~ z, G = 2, tau = 0.5) fitset.seed(1) d <- sim_gate2(n = 300) fit <- mixqrgate(y ~ x, data = d, gating = ~ z, G = 2, tau = 0.5) fit
mixqrgate()
Control parameters for mixqrgate()
mixqrgate_control( nstart = 10L, maxit = 500L, tol = 1e-06, gate_ridge = 0.001, gate_maxit = 50L, gate_tol = 1e-08, label_order = "slope", bandwidth = NULL, kde_grid = 512L, trace = FALSE, seed = NULL )mixqrgate_control( nstart = 10L, maxit = 500L, tol = 1e-06, gate_ridge = 0.001, gate_maxit = 50L, gate_tol = 1e-08, label_order = "slope", bandwidth = NULL, kde_grid = 512L, trace = FALSE, seed = NULL )
nstart |
Number of multi-start initialisations (the mixture likelihood is
multimodal). Default |
maxit |
Maximum EM iterations. Default |
tol |
Convergence tolerance on the relative parameter change. Default |
gate_ridge |
Ridge penalty on the gate coefficients (stabilises the
multinomial-logit M-step under separation / small samples). Default |
gate_maxit, gate_tol
|
Inner Newton iterations / tolerance for the gate
M-step. Defaults |
label_order |
Component ordering for label switching: |
bandwidth |
Optional KDE bandwidth override ( |
kde_grid |
KDE grid size ( |
trace |
Logical; print EM progress. Default |
seed |
Optional integer RNG seed. |
A list of class "mixqrgate_control".
which = "gating" draws the class-average gate probability against the
quantile level – the location-varying mixing picture that is Furno's headline
finding. which = "fit" draws the data coloured by class with the component
quantile lines at the first grid point.
## S3 method for class 'mixqrgate' plot(x, which = c("gating", "fit"), ...)## S3 method for class 'mixqrgate' plot(x, which = c("gating", "fit"), ...)
x |
A |
which |
|
... |
Passed to |
Invisibly x.
Predict gate probabilities or class membership
## S3 method for class 'mixqrgate' predict(object, newdata = NULL, type = c("prob", "class"), tau = NULL, ...)## S3 method for class 'mixqrgate' predict(object, newdata = NULL, type = c("prob", "class"), tau = NULL, ...)
object |
A |
newdata |
Optional data frame (must contain the gating covariates). |
type |
|
tau |
Quantile level at which to evaluate the (location-varying) gate; defaults to the first grid point. |
... |
Unused. |
A matrix of gate probabilities (type = "prob") or an integer vector
of class labels (type = "class").
Membership depends on a gating covariate z through a logit
Pr(class 2 | z) = plogis(gamma[1] + gamma[2] z); the two components are
quantile regressions of y on x with distinct slopes. Errors are
median-zero.
sim_gate2( n = 400L, gamma = c(0, 1.5), b1 = c(2, -3), b2 = c(-2, 3), sigma = c(1, 1.5), loc_vary = 0, het = FALSE )sim_gate2( n = 400L, gamma = c(0, 1.5), b1 = c(2, -3), b2 = c(-2, 3), sigma = c(1, 1.5), loc_vary = 0, het = FALSE )
n |
Sample size. |
gamma |
Length-2 gate coefficients (intercept, slope on |
b1, b2
|
Length-2 (intercept, slope) for components 1 and 2. |
sigma |
Length-2 error scales. |
loc_vary |
Strength of the location-varying gate (0 = membership independent of the quantile rank; larger = stronger upper-tail tilt toward class 2). |
het |
If |
With loc_vary > 0 the gate becomes genuinely location-varying in the
sense of Furno (2025): membership also depends on the latent quantile rank, so
class 2 is over-represented in the upper tail and the class composition –
hence the fitted gate – shifts across the quantile level. With het = TRUE
the second component's spread grows with x.
A data frame with y, x, z, and the true class.
Furno, M. (2025). Finite Mixture at Quantiles and Expectiles. JRFM 18(4), 177.
Reports, per quantile level, the component coefficients and the gate coefficients with standard errors, z- and p-values – the inference on how membership depends on the gating covariates (and, across the grid, on tau).
## S3 method for class 'mixqrgate' summary(object, ...)## S3 method for class 'mixqrgate' summary(object, ...)
object |
A |
... |
Unused. |
An object of class "summary.mixqrgate".