Skip to contents

The regression toolkit: ordinary least squares with the inference a summary() prints, White's heteroskedasticity-consistent standard errors in all four small-sample flavours, Newey-West HAC errors for serially correlated data, and the Breusch-Pagan, Durbin-Watson and variance-inflation diagnostics.

Value

morie_ols returns the coefficients with standard errors, t statistics and p-values, R^2 and adjusted R^2, the residual standard error and the overall F test. The covariance functions return vcov with its se; the diagnostics return the statistic and, where exact, its p-value.

Details

Every quantity is verified numerically against the implementation the field uses – lm/summary.lm, sandwich::vcovHC, sandwich::NeweyWest, lmtest::bptest, lmtest::dwtest and car::vif – so these can be relied on without depending on those packages. The same functions exist in the Python package as morie.fn._regression_core.

Note sandwich::NeweyWest selects its bandwidth automatically, whereas morie_newey_west_vcov defaults to Newey and West's own floor(4 (n/100)^(2/9)) rule; pass an explicit lags to compare the two directly.

References

White, H. (1980) A heteroskedasticity-consistent covariance matrix estimator. Econometrica 48, 817-838.

Newey, W. K. & West, K. D. (1987) A simple, positive semi-definite, heteroskedasticity and autocorrelation consistent covariance matrix. Econometrica 55, 703-708.

Koenker, R. (1981) A note on studentizing a test for heteroscedasticity. Journal of Econometrics 17, 107-112.