# statsmodels.regression.linear_model.RegressionResults.compare_lm_test¶

method

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

Use Lagrange Multiplier test to test whether restricted model is correct

Parameters
restrictedResult 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.

demeanbool

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_valuefloat

test statistic, chi2 distributed

p_valuefloat

p-value of the test statistic

df_diffint

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

Notes

TODO: explain LM text