import whittaker as wk
model = wk.GAM("y ~ s(x)", family=wk.tw(p_range=(1.05, 1.95), n_grid=15))tw()
Create a Tweedie family with estimated variance power.
Usage
tw(
p_range=(1.01, 1.99),
n_grid=20,
)Convenience constructor mirroring the tw() function familiar from mgcv. The variance power p of the Tweedie distribution (see Tweedie) is selected automatically by profile likelihood during model fitting rather than fixed by the user. The model is fitted at n_grid candidate values of p spaced across p_range, and the value minimizing AIC is chosen as the final family.
Parameters
p_range: tuple of float = (1.01, 1.99)-
(p_min, p_max)range to search. Must satisfy1 < p_minandp_max < 2(or both> 2for the positive-continuous case). Defaults to(1.01, 1.99), which covers the compound Poisson-Gamma case used for most zero-inflated positive data. n_grid: int = 20-
Number of candidate p values in the grid search. Defaults to
20.