statsmodels.stats.diagnostic.compare_encompassing

statsmodels.stats.diagnostic.compare_encompassing(results_x, results_z, cov_type='nonrobust', cov_kwds=None)[source]

Davidson-MacKinnon encompassing test for comparing non-nested models

Parameters:
results_xResult instance

result instance of first model

results_zResult instance

result instance of second model

cov_typestr, default “nonrobust

Covariance type. The default is “nonrobust` which uses the classic OLS covariance estimator. Specify one of “HC0”, “HC1”, “HC2”, “HC3” to use White’s covariance estimator. All covariance types supported by OLS.fit are accepted.

cov_kwdsdict, default None

Dictionary of covariance options passed to OLS.fit. See OLS.fit for more details.

Returns:
DataFrame

A DataFrame with two rows and four columns. The row labeled x contains results for the null that the model contained in results_x is equivalent to the encompassing model. The results in the row labeled z correspond to the test that the model contained in results_z are equivalent to the encompassing model. The columns are the test statistic, its p-value, and the numerator and denominator degrees of freedom. The test statistic has an F distribution. The numerator degree of freedom is the number of variables in the encompassing model that are not in the x or z model. The denominator degree of freedom is the number of observations minus the number of variables in the nesting model.

Notes

The null is that the fit produced using x is the same as the fit produced using both x and z. When testing whether x is encompassed, the model estimated is

\[Y = X\beta + Z_1\gamma + \epsilon\]

where \(Z_1\) are the columns of \(Z\) that are not spanned by \(X\). The null is \(H_0:\gamma=0\). When testing whether z is encompassed, the roles of \(X\) and \(Z\) are reversed.

Implementation of Davidson and MacKinnon (1993)’s encompassing test. Performs two Wald tests where models x and z are compared to a model that nests the two. The Wald tests are performed by using an OLS regression.


Last update: Dec 16, 2024