GaussianLS#

class superglm.GaussianLS(scale_floor: float = 0.01)#

Bases: LocationPredictor, ScalePredictor

Gaussian responses with separate mean and standard-deviation predictors.

Declare family.location(...) for the conditional mean and family.scale(...) for the standard deviation. Location uses an identity link. Scale uses log(scale - scale_floor). Results use the column names location and scale in 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

SuperLSS

Construct and fit a model with these predictors.

censored_recession(
bounds: ResponseBounds,
) → NDArray[bool]#

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 and P(Y <= c) falls with the location within any truncation window. A row right-censored at c above a lower truncation bound a with no upper bound has P(Y > c | Y > a) < 1 at 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 at c_i has a finite estimate only when sum (mu_i - c_i) > 0 while some mu_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 above c, so the location decides.

to_config() → dict[str, Any]#

Return JSON-safe complete family configuration.

predictor_curvature_directional_derivative(
y: NDArray,
eta: NDArray,
eta_direction: NDArray,
links: Sequence[Link],
plan: FamilyLikelihoodPlan,
) → NDArray[float64]#

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,
) → NDArray[float64]#

Differentiate observed predictor curvature twice, along a then b.

log_window_probability(
lower: NDArray,
upper: NDArray,
theta: NDArray,
weights: NDArray | None = None,
) → NDArray[float64]#

log P(lower < Y <= upper) under each row’s law, from the tail-safe window kernel.

cdf(
y: NDArray,
theta: NDArray,
) → NDArray[float64]#

P(Y <= y) per row from (location, scale).

quantile(
p: NDArray,
theta: NDArray,
) → NDArray[float64]#

The p-quantile per row from (location, scale), p inside (0, 1).

expected_shortfall(
p: NDArray,
theta: NDArray,
) → NDArray[float64]#

E[Y | Y > q_p] for the unit-weight Gaussian row law.

variance(
theta: NDArray,
) → NDArray[float64]#

Var(Y) = sigma^2 per row at unit prior weight.

variance_prior_weighted(
theta: NDArray,
weights: NDArray,
) → NDArray[float64]#

Var(Y) = sigma^2 / w per row: the prior weight scales the variance.

cdf_prior_weighted(
y: NDArray,
theta: NDArray,
weights: NDArray,
) → NDArray[float64]#

P(Y <= y) per row when a prior weight scales the variance to sigma^2 / w.

quantile_prior_weighted(
p: NDArray,
theta: NDArray,
weights: NDArray,
) → NDArray[float64]#

The prior-weighted p-quantile per row, p inside (0, 1).

expected_shortfall_prior_weighted(
p: NDArray,
theta: NDArray,
weights: NDArray,
) → NDArray[float64]#

E[Y | Y > q_p] when the prior weight scales variance by 1 / w.