statsmodels.gam.generalized_additive_model.GLMGamResults.cov_params

GLMGamResults.cov_params(r_matrix=None, column=None, scale=None, cov_p=None, other=None)

Compute the variance/covariance matrix.

The variance/covariance matrix can be of a linear contrast of the estimated parameters or all params multiplied by scale which will usually be an estimate of sigma^2. Scale is assumed to be a scalar.

Parameters:
r_matrixarray_like

Can be 1d, or 2d. Can be used alone or with other.

columnarray_like, optional

Must be used on its own. Can be 0d or 1d see below.

scalefloat, optional

Can be specified or not. Default is None, which means that the scale argument is taken from the model.

cov_pndarray, optional

The covariance of the parameters. If not provided, this value is read from self.normalized_cov_params or self.cov_params_default.

otherarray_like, optional

Can be used when r_matrix is specified.

Returns:
ndarray

The covariance matrix of the parameter estimates or of linear combination of parameter estimates. See Notes.

Notes

(The below are assumed to be in matrix notation.)

If no argument is specified returns the covariance matrix of a model (scale)*(X.T X)^(-1)

If contrast is specified it pre and post-multiplies as follows (scale) * r_matrix (X.T X)^(-1) r_matrix.T

If contrast and other are specified returns (scale) * r_matrix (X.T X)^(-1) other.T

If column is specified returns (scale) * (X.T X)^(-1)[column,column] if column is 0d

OR

(scale) * (X.T X)^(-1)[column][:,column] if column is 1d


Last update: Nov 12, 2024