statsmodels.gam.generalized_additive_model.GLMGam.predict

GLMGam.predict(params, exog=None, exposure=None, offset=None, which='mean', linear=None)

Return predicted values for a design matrix

Parameters:
paramsarray_like

Parameters / coefficients of a GLM.

exogarray_like, optional

Design / exogenous data. Is exog is None, model exog is used.

exposurearray_like, optional

Exposure time values, only can be used with the log link function. See notes for details.

offsetarray_like, optional

Offset values. See notes for details.

which‘mean’, ‘linear’, ‘var’(optional)

Statitistic to predict. Default is ‘mean’.

  • ‘mean’ returns the conditional expectation of endog E(y | x), i.e. inverse of the model’s link function of linear predictor.

  • ‘linear’ returns the linear predictor of the mean function.

  • ‘var_unscaled’ variance of endog implied by the likelihood model. This does not include scale or var_weights.

linearbool

The linear` keyword is deprecated and will be removed, use ``which keyword instead. If True, returns the linear predicted values. If False or None, then the statistic specified by which will be returned.

Returns:
An array of fitted values

Notes

Any exposure and offset provided here take precedence over the exposure and offset used in the model fit. If exog is passed as an argument here, then any exposure and offset values in the fit will be ignored.

Exposure values must be strictly positive.


Last update: Dec 16, 2024