GaussianLS#
- class superglm.GaussianLS(scale_floor: float = 0.01)#
Bases:
LocationPredictor,ScalePredictorGaussian responses with separate mean and standard-deviation predictors.
Declare
family.location(...)for the conditional mean andfamily.scale(...)for the standard deviation. Location uses an identity link. Scale useslog(scale - scale_floor). Results use the column nameslocationandscalein that order.- Parameters:
- scale_floorfloat, default=0.01
Nonnegative lower bound on the standard deviation, in response units. Fitted scale values stay strictly above this bound.
See also
SuperLSSConstruct and fit a model with these predictors.
- censored_recession(
- bounds: ResponseBounds,
Every censored row escapes along the location; a row truncated only on the far side of its limit also escapes along the scale.
The normal density is log-concave, so its location family has a monotone likelihood ratio:
P(Y > c)rises andP(Y <= c)falls with the location within any truncation window. A row right-censored atcabove a lower truncation boundawith no upper bound hasP(Y > c | Y > a) < 1at every finite scale, tending to one as the scale grows whatever the location, so a level of such rows has no finite scale (mirrored for a left-censored row with only an upper bound). Elsewhere the scale is not decided before the fit: an untruncated level right-censored atc_ihas a finite estimate only whensum (mu_i - c_i) > 0while somemu_i < c_i(mirrored for left-censored rows), and with both truncation bounds the probability tends to(b - c)/(b - a)as the scale grows but to one as it shrinks with the location abovec, so the location decides.
- predictor_curvature_directional_derivative(
- y: NDArray,
- eta: NDArray,
- eta_direction: NDArray,
- links: Sequence[Link],
- plan: FamilyLikelihoodPlan,
Differentiate observed predictor curvature along one predictor path.
- predictor_curvature_second_directional_derivative(
- y: NDArray,
- eta: NDArray,
- direction_a: NDArray,
- direction_b: NDArray,
- links: Sequence[Link],
- plan: FamilyLikelihoodPlan,
Differentiate observed predictor curvature twice, along
athenb.
- log_window_probability(
- lower: NDArray,
- upper: NDArray,
- theta: NDArray,
- weights: NDArray | None = None,
log P(lower < Y <= upper)under each row’s law, from the tail-safe window kernel.
- cdf(
- y: NDArray,
- theta: NDArray,
P(Y <= y)per row from(location, scale).
- quantile(
- p: NDArray,
- theta: NDArray,
The
p-quantile per row from(location, scale),pinside(0, 1).
- expected_shortfall(
- p: NDArray,
- theta: NDArray,
E[Y | Y > q_p]for the unit-weight Gaussian row law.
- variance(
- theta: NDArray,
Var(Y) = sigma^2per row at unit prior weight.
- variance_prior_weighted(
- theta: NDArray,
- weights: NDArray,
Var(Y) = sigma^2 / wper row: the prior weight scales the variance.
- cdf_prior_weighted(
- y: NDArray,
- theta: NDArray,
- weights: NDArray,
P(Y <= y)per row when a prior weight scales the variance tosigma^2 / w.
- quantile_prior_weighted(
- p: NDArray,
- theta: NDArray,
- weights: NDArray,
The prior-weighted
p-quantile per row,pinside(0, 1).
- expected_shortfall_prior_weighted(
- p: NDArray,
- theta: NDArray,
- weights: NDArray,
E[Y | Y > q_p]when the prior weight scales variance by1 / w.