Statistics & probability

Quantile regression calculator from response and predictors

Quantile regression models a conditional quantile rather than a conditional mean.

Your numbers

At most 12 rows and four columns; enter ones for an intercept.
One response per design row.
Between 0.01 and 0.99.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Quantile regression models a conditional quantile rather than a conditional mean. This calculator translates the asymmetric pinball loss into an exact rational linear program, solves the bounded model and reports coefficients and residuals. An intercept is included only when a column of ones is supplied explicitly.

THE FORMULAmin_beta Σ rho_tau(y_i−x_i beta); rho_tau(u)=u(tau−I[u<0]).

A worked example

With an intercept-only design and responses 1,2,3,4,20 at tau=0.5, the fitted median is three. Absolute deviations sum to 21, so the pinball objective is 10.5. The unusually large final response changes the mean substantially while the median fit remains three.

Good to know

At most 12 observations and four design columns, with 2p+2n≤32. Decimal inputs use the bounded rational parser. Nonunique coefficient optima may occur. No automatic intercept, standard errors, confidence bands or unrestricted large-data solver.

Pinball loss selects a quantile

A positive residual means the observation lies above the fitted quantile. Pinball loss weights that residual by tau and a negative residual by one minus tau. At one half, minimizing this loss is the same as minimizing absolute deviations, which explains the intercept-only median example.

Changing tau changes the target of the entire regression rather than merely moving a confidence level around a conditional mean. A fitted high quantile can answer an upper-tail question, but it is not automatically an upper prediction bound with a guaranteed coverage rate for every new observation.

Median regression balances asymmetric residual penalties at tau one halfResidual zeroFit: median = 3Σ |residual| = 21Pinball loss = 10.5
With an intercept-only design and responses 1,2,3,4,20 at tau=0.5, the fitted median is three. Absolute deviations sum to 21, so the pinball objective is 10.5. The unusually large final response changes the mean substantially while the median fit remains three.

The GLM regression calculator from response and design matrix covers the nearby task. Existing Gaussian GLM fits conditional means; quantile regression optimizes an asymmetric absolute loss.

Exact optimization does not ensure unique coefficients

The linear-program formulation splits unrestricted coefficients into nonnegative parts and represents positive and negative residuals separately. The exact simplex result has primal and dual feasibility checks. This verifies the stated finite optimization problem, including decimal-to-rational conversion, instead of relying only on a small iterative coefficient change.

Absolute-loss objectives can have flat optimal regions. Different valid coefficient vectors may therefore achieve the same minimum objective, especially with ties or a small design. The returned vector is one optimum; compare objective and residual conditions before concluding that a different package’s equally optimal coefficients are wrong.

Interpret the model with its supplied design

The design is entered directly, so an intercept must be represented by a column of ones. Adding or removing that column changes the feasible fitted functions. Predictor scaling can improve interpretation, but a singular or redundant design still needs a deliberate decision about which columns represent the intended model.

The strict row and variable caps keep the exact rational program manageable in a browser. They are not a claim that quantile regression is useful only for tiny data sets. Larger studies require an appropriate implementation and inference method; this page provides no coefficient uncertainty estimates from its optimization certificate alone.

Understand the asymmetric loss before choosing tau

For residual u=y−xβ, pinball loss is τu when u is positive and (τ−1)u when it is negative. At τ=0.5 both sides have slope magnitude one half, giving half the absolute-error objective. At τ=0.8 an underprediction is penalized four times as strongly as an overprediction of the same size, shifting an intercept-only fit toward the upper observations.

This asymmetry estimates a conditional quantile, not a confidence limit for a mean. A fitted 0.8 quantile is intended to have about 80% of responses below it under the model, but a small training sample need not show that exact fraction. Covariate patterns and discrete responses can prevent an exact empirical split even when the optimization is correct.

Compare median and upper-quantile fits by hand

Keep five rows of ones as the design and responses 1,2,3,4,20. At τ=0.5, β=3 gives residuals −2,−1,0,1,17 and loss 0.5×21=10.5. Ordinary least squares instead gives the mean 6, illustrating how a large response affects the center differently under squared and absolute losses.

At τ=0.8, every intercept between 4 and 20 minimizes the objective. For β=4, loss is 0.2×(3+2+1)+0.8×16=14. For β=20, loss is 0.2×(19+18+17+16)=14 too. The calculator may return one endpoint. Different coefficients from another solver can therefore represent the same optimum; compare objective values and fitted behavior before calling the difference an error.

Build a design matrix that represents your question

An intercept is a literal column of ones. For a straight-line conditional quantile, enter rows such as 1,0;1,1;1,2, with one matching response for each row. Without the ones, the fitted line is constrained through the origin. Categorical predictors require a deliberate indicator coding, with a reference category if an intercept is present; typing category names into numeric fields is not supported.

The linear program writes each residual as u+−u− with both parts nonnegative and minimizes τΣu++(1−τ)Σu−. Exact rational arithmetic avoids a floating-point tolerance deciding whether a small residual is positive. It does not remove model misspecification or make the supplied decimals more precise than the original measurements.

Use separate quantile fits with care

Fitting several τ values independently can produce crossing fitted lines. That is a property of unconstrained quantile regressions, not proof that the optimization failed. A noncrossing model would require additional constraints and is outside this form. Likewise, an extreme quantile fitted to very few observations can depend heavily on one or two points.

Inspect whether the chosen quantile answers an operational question, such as a high delivery-time threshold, and whether a linear predictor is plausible over the observed covariate range. Do not extrapolate far beyond that range or describe the coefficients as causal effects without a separate study design. This page supplies neither standard errors nor prediction-coverage validation on held-out observations.

A few questions, answered

Why does tau one half give a median fit?

Pinball loss then equals half the absolute residual, whose intercept-only minimizers are medians.

Can optimal coefficients be nonunique?

Yes. The exact LP certifies the objective but does not assert a unique parameter vector.

Why can two correct solvers give different intercepts?

The pinball objective can have a flat minimum. For the five-response example at tau=0.8, every intercept from 4 through 20 has loss 14.

Is the fitted upper quantile a confidence interval?

No. It describes a conditional response quantile. Uncertainty about an estimated mean or coefficient requires a separate inferential procedure.

Find your calculator

Start typing to explore the library.