Skip to contents

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.

Usage

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
)

Arguments

n

Sample size.

gamma

Length-2 gate coefficients (intercept, slope on z).

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 TRUE, component-2 spread grows with x (heteroscedastic).

Value

A data frame with y, x, z, and the true class.

Details

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.

References

Furno, M. (2025). Finite Mixture at Quantiles and Expectiles. JRFM 18(4), 177.