Skip to contents

Approximates a target quantile function by Q_mu(u) = sum_j lambda_j Q_j(u) over a quantile basis, estimating the weights by matching the first L sample L-moments to the mixture's L-moments (Alvarez & Orestes 2024, eq. 2). The problem reduces to a convex quadratic program.

Usage

qfmix(
  q,
  basis = "legendre",
  p = 4L,
  L = NULL,
  constraint = c("unconstrained", "ridge", "nonneg", "simplex"),
  M = 1,
  weight = c("identity", "optimal"),
  trim = c(0, 1),
  monotone = FALSE,
  n_grid = 1000L,
  controls = NULL,
  control = qfmix_control()
)

Arguments

q

Target: a numeric sample, a quantile function, or a qfmix object.

basis

A basis name (see qfmix_basis()) or a qfmix_basis object.

p

Sieve dimension (number of basis functions). Default 4.

L

Number of L-moments matched (>= p). Default max(p, p + 2).

constraint

Weight set: "unconstrained", "ridge", "nonneg", or "simplex". (The "lasso" set and an osqp backend are planned; this version solves the constrained programs with quadprog.)

M

Radius for "ridge" (default 1, the DSC choice).

weight

L-moment weighting matrix: "identity" or "optimal" (two-step).

trim

Trimming window c(a, b) for the L-moment integrals.

monotone

If TRUE, add grid constraints forcing Q_mu nondecreasing.

n_grid

Integration grid resolution.

controls

For the empirical basis: control observations (see qfmix_basis()).

control

A qfmix_control() list.

Value

An object of class "qfmix".

References

Alvarez, L. A. F. & Orestes, V. M. (2024). Quantile Mixture Models: Estimation and Inference.

Examples

set.seed(1)
x <- qexp(runif(500))                       # an exponential sample
fit <- qfmix(x, basis = "legendre", p = 4)
predict(fit, c(0.25, 0.5, 0.75))
#> [1] 0.3925890 0.5495353 1.3575307