statsmodels.gam.generalized_additive_model.GLMGamResults.get_hat_matrix_diag

GLMGamResults.get_hat_matrix_diag(observed=True, _axis=1)[source]

Compute the diagonal of the hat matrix

Parameters:
observedbool

If true, then observed hessian is used in the hat matrix computation. If false, then the expected hessian is used. In the case of a canonical link function both are the same. This is only relevant for models that implement both observed and expected Hessian, which is currently only GLM. Other models only use the observed Hessian.

_axisint

This is mainly for internal use. By default it returns the usual diagonal of the hat matrix. If _axis is zero, then the result corresponds to the effective degrees of freedom, edf for each column of exog.

Returns:
hat_matrix_diagndarray

The diagonal of the hat matrix computed from the observed or expected hessian.