GeneralizedGammaLSS#
- class superglm.GeneralizedGammaLSS( )#
Bases:
MeanPredictor,LocationPredictor,ScalePredictor,ShapePredictorGeneralized gamma with natural parameters
(mean | location, scale, shape).Prentice’s
(mu, sigma, Q)law ony > 0:shape = 0is the log-normal,shape = 1the Weibull,shape = scalethe gamma. The default mean form putsE[Y]first under a log link, so its relativities multiply the mean; the location form puts the log-scale location first under an identity link and admits an infinite mean.- Parameters:
- parametrisation{“mean”, “location”}, default=”mean”
Choose
family.mean(...)for the conditional response mean orfamily.location(...)for Prentice’s log-scale location. Declarefamily.scale(...)andfamily.shape(...)in either form. Scale is Prentice’s sigma and shape is Q. Scale need not equal the standard deviation of the response or its logarithm.- scale_floorfloat, default=0.01
Nonnegative lower bound on scale. Its default link is
log(scale - scale_floor). Shape uses an identity link.
Notes
Changing the first parameter changes what its additive predictor describes. The mean form requires a finite response mean. Results contain
mean, scale, shapeorlocation, scale, shape.predictreturns the response mean in both forms, including infinity where the mean does not exist in the location form.- censored_recession(
- bounds: ResponseBounds,
Every censored row escapes along the location or mean; none along scale or shape.
At a fixed scale and shape
log Y = mu + sigma Wis a location family inmu, and the mean form’smu = log m - log C(sigma, Q)is a strictly increasing shift.W’s density is log-concave (d^2 log f/dw^2 = -e^(Q w)), so the family has a monotone likelihood ratio inmu, and within any truncation windowP(Y > c)rises andP(Y <= c)falls strictly withmu. Along the scale or the shape a bound probability’s limit depends on the fitted location and the other parameter, so those predictors are not flagged.
- 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.
- variance(
- theta: NDArray,
Population variance, with infinity for a divergent second moment.
- log_window_probability(
- lower: NDArray,
- upper: NDArray,
- theta: NDArray,
- weights: NDArray | None = None,
log P(lower < Y <= upper)per row; NaN where the mean form’s mean does not exist.
- expected_shortfall(
- p: NDArray,
- theta: NDArray,
E[Y | Y > q_p]per row in either natural parametrisation.