statsmodels.regression.linear_model.OLSResults.wald_test

OLSResults.wald_test(r_matrix, cov_p=None, invcov=None, use_f=None, df_constraints=None, scalar=None)

Compute a Wald-test for a joint linear hypothesis.

Parameters
r_matrix{array_like, str, tuple}

One of:

  • array : An r x k array where r is the number of restrictions to test and k is the number of regressors. It is assumed that the linear combination is equal to zero.

  • str : The full hypotheses to test can be given as a string. See the examples.

  • tuple : A tuple of arrays in the form (R, q), q can be either a scalar or a length p row vector.

cov_parray_like, optional

An alternative estimate for the parameter covariance matrix. If None is given, self.normalized_cov_params is used.

invcovarray_like, optional

A q x q array to specify an inverse covariance matrix based on a restrictions matrix.

use_fbool

If True, then the F-distribution is used. If False, then the asymptotic distribution, chisquare is used. If use_f is None, then the F distribution is used if the model specifies that use_t is True. The test statistic is proportionally adjusted for the distribution by the number of constraints in the hypothesis.

df_constraintsint, optional

The number of constraints. If not provided the number of constraints is determined from r_matrix.

scalarbool, optional

Flag indicating whether the Wald test statistic should be returned as a sclar float. The current behavior is to return an array. This will switch to a scalar float after 0.14 is released. To get the future behavior now, set scalar to True. To silence the warning and retain the legacy behavior, set scalar to False.

Returns
ContrastResults

The results for the test are attributes of this results instance.

See also

f_test

Perform an F tests on model parameters.

t_test

Perform a single hypothesis test.

statsmodels.stats.contrast.ContrastResults

Test results.

patsy.DesignInfo.linear_constraint

Specify a linear constraint.

Notes

The matrix r_matrix is assumed to be non-singular. More precisely,

r_matrix (pX pX.T) r_matrix.T

is assumed invertible. Here, pX is the generalized inverse of the design matrix of the model. There can be problems in non-OLS models where the rank of the covariance of the noise is not full.