models.Gam

A generalized additive model: a Glm plus P-spline smooths of

Usage

models.Gam()

numeric design columns, with smoothing chosen by GCV or UBRE.

Parameters

glm: Glm

Family, link and dispersion.

smooths: list of str or (str, int)

The design columns to smooth, optionally with the number of basis functions (10 by default).

smoothing: str or list of float = "auto"
"auto" (UBRE for a fixed dispersion, GCV otherwise), "gcv", "ubre", or fixed smoothing parameters, one per smooth.

Examples

>>> import math
>>> from prospicio.models import Design, Gam, Glm
>>> x = [i / 99 for i in range(100)]
>>> y = [math.sin(6 * v) for v in x]
>>> d = Design([[1.0] * 100, x], ["(Intercept)", "x"])
>>> fit = Gam(Glm("gaussian"), ["x"]).fit(d, y)
>>> abs(fit.predict(d)[50] - y[50]) < 0.01

True

Methods

Name Description
fit() Fits the model.

fit()

Fits the model.

Usage

fit(design, y)
Parameters
design: Design

Includes the raw columns to smooth.

y: list of float
Returns
GamFit