Skip to main content

models.DoubleGlm

A double GLM: a GLM for the mean and a gamma GLM with the log link for

Usage

Source

models.DoubleGlm()

the dispersion, each on its own design, as R’s dglm with its mean step’s weights corrected.

Parameters

family: str

"gaussian", "poisson", "gamma" or "tweedie".

link: str

The mean’s link; by default the log link for the gamma, inverse Gaussian and Tweedie, the canonical link otherwise.

power: float

The Tweedie’s power, in (1, 2).

method: str

"ml" (the default, as dglm) or "reml".

link_power: float
The power link’s exponent.

Examples

>>> from prospicio.models import Design, DoubleGlm
>>> urban = [0.0] * 4 + [1.0] * 4
>>> d = Design([[1.0] * 8, urban], ["(Intercept)", "urban"])
>>> y = [9.0, 11.0, 10.0, 10.5, 4.0, 18.0, 6.0, 15.0]
>>> fit = DoubleGlm("gamma", link="log").fit(d, d, y)
>>> fit.dispersion_coefficients[1] > 0

True

Methods

Name Description
fit() Fits the mean on mean (its offset and prior weights apply) and

fit()

Fits the mean on mean (its offset and prior weights apply) and

Usage

Source

fit(mean, dispersion, y)

the log dispersion on dispersion (its offset applies).

Returns
DoubleGlmFit