3.9.2.2.6.1.11. statsmodels.regression.linear_model.RegressionResults.compare_lm_test

RegressionResults.compare_lm_test(restricted, demean=True, use_lr=False)[source]

Use Lagrange Multiplier test to test whether restricted model is correct

Parameters:

restricted : Result instance

The restricted model is assumed to be nested in the current model. The result instance of the restricted model is required to have two attributes, residual sum of squares, ssr, residual degrees of freedom, df_resid.

demean : bool

Flag indicating whether the demean the scores based on the residuals from the restricted model. If True, the covariance of the scores are used and the LM test is identical to the large sample version of the LR test.

Returns:

lm_value : float

test statistic, chi2 distributed

p_value : float

p-value of the test statistic

df_diff : int

degrees of freedom of the restriction, i.e. difference in df between models

Notes

TODO: explain LM text