linear_rainbow(res, frac=0.5, order_by=None, use_distance=False, center=None)¶
Rainbow test for linearity
The null hypothesis is the fit of the model using full sample is the same as using a central subset. The alternative is that the fits are difference. The rainbow test has power against many different forms of nonlinearity.
A results instance from a linear regression.
The fraction of the data to include in the center model.
If an ndarray, the values in the array are used to sort the observations. If a string or a list of strings, these are interpreted as column name(s) which are then used to lexicographically sort the data.
Flag indicating whether data should be ordered by the Mahalanobis distance to the center.
If a float, the value must be in [0, 1] and the center is center * nobs of the ordered data. If an integer, must be in [0, nobs) and is interpreted as the observation of the ordered data to use.
This test assumes residuals are homoskedastic and may reject a correct linear specification if the residuals are heteroskedastic.