Skip to main content

kernels.TweedieFit

A fitted Tweedie GLM on one triangle’s increments.

Usage

Source

kernels.TweedieFit(
    spec,
    origin_periods,
    as_of,
    dev_grain_months,
    cumulative,
    increments,
    fitted,
    latest,
    latest_dev,
    terms,
    coef,
    coef_se,
    fitted_zero,
    deviance,
    pearson_chi2,
    dispersion,
    n_obs,
    n_params,
    iterations
)

Arrays are (n_w, n_d) (origins by development ages) unless noted. Amounts are in the units of the input.

Attributes

spec: TweedieSpec
origin_periods: list of datetime.date

The first day of each origin period.

as_of: datetime.date

The evaluation date of the latest cell.

dev_grain_months: int
cumulative: numpy.ndarray

The cumulative amounts, NaN where unobserved.

increments: numpy.ndarray

The incremental amounts, NaN where unobserved.

fitted: numpy.ndarray

The fitted increment in every cell, observed or not; exactly 0.0 in an origin or age fitted at zero.

latest: numpy.ndarray

(n_w,) each origin’s latest cumulative.

latest_dev: numpy.ndarray

(n_w,) the 0-based development index of each origin’s latest cell.

terms: tuple

(kind, index) per coefficient: ("intercept", None), ("origin", i), ("development", j) or ("calendar", None). The reference origin and age have no term.

coef: numpy.ndarray

The estimates on the link scale; NaN for a term fitted at zero.

coef_se: numpy.ndarray

sqrt(dispersion * diag((X'WX)^-1)); NaN for a term fitted at zero or when the dispersion is undefined.

fitted_zero: numpy.ndarray

Bool per term: the origin or age was fitted at exactly zero.

deviance, pearson_chi2: float

Summed over the observed cells in the regression.

dispersion: float

pearson_chi2 / (n_obs - n_params); NaN when n_obs == n_params.

n_obs: int

Observed cells in the regression (cells of an origin or age fitted at zero are not counted).

n_params: int

Estimated coefficients.

iterations: int
Fisher-scoring steps taken.

Attributes

Name Description
cdf Each origin’s fitted factor from each age to the last; NaN where the
common_pattern Whether every origin’s fitted factors agree to 1e-12 relative.
factors (n_w, n_d - 1) each origin’s fitted factor from one age to the next.
future Bool, the cells past each origin’s latest age.
model_ibnr (n_w,) the sum of each origin’s fitted future increments.
pattern (n_d - 1,) the common fitted factors under the log link (NaN from
pearson_residuals (y - mu) / sqrt(mu ** power), unscaled by the dispersion; NaN where
ultimate (n_w,) each origin’s ultimate under spec.projection.

cdf

Each origin’s fitted factor from each age to the last; NaN where the

cdf: np.ndarray

fitted cumulative is 0.


common_pattern

Whether every origin’s fitted factors agree to 1e-12 relative.

common_pattern: bool

Always true under the log link, where exp(a[i]) separates from the development terms; usually false under the identity link.


factors

(n_w, n_d - 1) each origin’s fitted factor from one age to the next.

factors: np.ndarray

NaN where the fitted cumulative at the earlier age is 0.


future

Bool, the cells past each origin’s latest age.

future: np.ndarray


model_ibnr

(n_w,) the sum of each origin’s fitted future increments.

model_ibnr: np.ndarray


pattern

(n_d - 1,) the common fitted factors under the log link (NaN from

pattern: np.ndarray | None

an age whose fitted cumulative is 0), or None under the identity link.


pearson_residuals

(y - mu) / sqrt(mu ** power), unscaled by the dispersion; NaN where

pearson_residuals: np.ndarray

unobserved or where the fitted mean is 0. Written mu ** (power / 2), so a mean near the smallest double does not underflow to 0 when raised to the full power.


ultimate

(n_w,) each origin’s ultimate under spec.projection.

ultimate: np.ndarray