Skip to main content

models.QuantileFit

A fitted quantile regression, from QuantileRegression.fit.

Usage

Source

models.QuantileFit()

Attributes

Name Description
bandwidth The kernel’s bandwidth on the residuals’ scale.
covariance The kernel sandwich covariance, a list of rows.
objective The minimised weighted check loss (rq’s rho leaves the
standard_errors Powell’s kernel standard errors.

bandwidth

The kernel’s bandwidth on the residuals’ scale.

bandwidth: float


covariance

The kernel sandwich covariance, a list of rows.

covariance: list[list[float]]


objective

The minimised weighted check loss (rq’s rho leaves the

objective: float

weights out).


standard_errors

Powell’s kernel standard errors.

standard_errors: list[float]

Methods

Name Description
from_json() Reads an artifact written by to_json.
predict() The fitted quantile of each row.
predict_distribution() Draws of each row’s fitted quantile from the coefficients’ normal
to_json() The fit as a versioned JSON artifact: the level, the names, the

from_json()

Reads an artifact written by to_json.

Usage

Source

from_json(text)
Parameters
text: str
Returns
QuantileFit
Raises
ValueError
For malformed JSON, another format, a newer format version or inconsistent fields.

predict()

The fitted quantile of each row.

Usage

Source

predict(design)

predict_distribution()

Draws of each row’s fitted quantile from the coefficients’ normal

Usage

Source

predict_distribution(design, n_sims, seed)

approximation: the quantile’s uncertainty, not the response’s.

Returns
PredictiveDistribution

to_json()

The fit as a versioned JSON artifact: the level, the names, the

Usage

Source

to_json()

estimates and their covariance, and the fit statistics, numbers bit for bit (#978). from_json reads it back; pickle uses the same document.

Returns
str
Examples
>>> import pickle
>>> from prospicio.models import Design, QuantileRegression, QuantileFit
>>> d = Design([[1.0] * 6, [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]], ["(Intercept)", "x"])
>>> fit = QuantileRegression(0.5).fit(d, [1.0, 2.5, 2.0, 4.0, 5.5, 5.0])
>>> QuantileFit.from_json(fit.to_json()).coefficients == fit.coefficients

True

>>> pickle.loads(pickle.dumps(fit)).coefficients == fit.coefficients

True