5.5. statsmodels.sandbox.gam¶
Generalized additive models
5.5.1. Requirements for smoothers¶
smooth(y, weights=xxx) : ? no return ? alias for fit predict(x=None) : smoothed values, fittedvalues or for new exog df_fit() : degress of freedom of fit ?
5.5.2. Notes¶
- using PolySmoother works for AdditiveModel, and GAM with Poisson and Binomial
- testfailure with Gamma, no other families tested
- there is still an indeterminacy in the split up of the constant across components (smoothers) and alpha, sum, i.e. constant, looks good. - role of offset, that I haven’t tried to figure out yet
5.5.3. Refactoring¶
currently result is attached to model instead of other way around split up Result in class for AdditiveModel and for GAM, subclass GLMResults, needs verification that result statistics are appropriate how much inheritance, double inheritance? renamings and cleanup interface to other smoothers, scipy splines
basic unittests as support for refactoring exist, but we should have a test case for gamma and the others. Advantage of PolySmoother is that we can benchmark against the parametric GLM results.
5.5.4. Functions¶
default_smoother (x[, s_arg]) |
5.5.5. Classes¶
AdditiveModel (exog[, smoothers, weights, family]) |
additive model with non-parametric, smoothed components |
GLM (endog, exog[, family, offset, exposure, ...]) |
Generalized Linear Models class |
Model (endog, exog[, smoothers, family]) |
|
Offset (fn, offset) |
|
PolySmoother (order[, x]) |
Polynomial smoother up to a given order. |
Results (Y, alpha, exog, smoothers, family, ...) |
5.5.6. Exceptions¶
IterationLimitWarning |