# statsmodels.stats.diagnostic.linear_lm¶

statsmodels.stats.diagnostic.linear_lm(resid, exog, func=None)[source]

Lagrange multiplier test for linearity against functional alternative

limitations: Assumes currently that the first column is integer. Currently it doesn’t check whether the transformed variables contain NaNs, for example log of negative number.

Parameters: resid (ndarray) – residuals of a regression exog (ndarray) – exogenous variables for which linearity is tested func (callable) – If func is None, then squares are used. func needs to take an array of exog and return an array of transformed variables. lm (float) – Lagrange multiplier test statistic lm_pval (float) – p-value of Lagrange multiplier tes ftest (ContrastResult instance) – the results from the F test variant of this test

Notes

written to match Gretl’s linearity test. The test runs an auxilliary regression of the residuals on the combined original and transformed regressors. The Null hypothesis is that the linear specification is correct.