models.TweedieGlm
A Tweedie GLM whose power is estimated with its coefficients and
Usage
models.TweedieGlm()dispersion by maximum likelihood: the profile log-likelihood over the power, maximized by Brent’s method, with a 95% profile-likelihood interval (R’s tweedie.profile’s method).
Parameters
link: str = "log"min_power: float = 1.01 and 1.99-
The search bounds, inside
(1, 2). max_power: float = 1.01 and 1.99-
The search bounds, inside
(1, 2).
Examples
>>> from prospicio.models import Design, TweedieGlm
>>> from prospicio.distributions import Tweedie
>>> import math
>>> x = [float(i % 4) for i in range(400)]
>>> y = [Tweedie(math.exp(0.5 + 0.3 * v), 2.0, 1.5).quantile((i * 0.618034) % 1 * 0.98 + 0.01)
... for i, v in enumerate(x)]
>>> fit = TweedieGlm().fit(Design([[1.0] * 400, x], ["(Intercept)", "x"]), y)
>>> abs(fit.power - 1.5) < 0.1True
Methods
| Name | Description |
|---|---|
| fit() | Fits the power, the dispersion and the coefficients. |
fit()
Fits the power, the dispersion and the coefficients.
Usage
fit(design, y)Returns
TweedieFit