Call Us: US - +1 845 478 5244 | UK - +44 20 7193 7850 | AUS - +61 2 8005 4826

Basic models: linear regression

Base R ships with a lot of functionality useful for computational econometrics, in particular in the stats package. This functionality is complemented by many packages on CRAN, a brief overview is given below. There is also a considerable overlap between the tools for econometrics in this view and those in the task views on FinanceSocialSciences, and TimeSeries. Furthermore, the Finance SIG is a suitable mailing list for obtaining help and discussing questions about both computational finance and econometrics.

The packages in this view can be roughly structured into the following topics. If you think that some package is missing from the list, please contact the maintainer.

Basic linear regression

  • Estimation and standard inference : Ordinary least squares (OLS) estimation for linear models is provided by lm() (from stats) and standard tests for model comparisons are available in various methods such as summary() and anova().
  • Further inference and nested model comparisons : Functions analogous to the basic summary() and anova() methods that also support asymptotic tests ( instead of tests, and Chi-squared instead of Ftests) and plug-in of other covariance matrices are coeftest() and waldtest() in lmtest. Tests of more general linear hypotheses are implemented in linearHypothesis() and for nonlinear hypotheses indeltaMethod() in car.
  • Robust standard errors : HC, HAC, clustered, and bootstrap covariance matrices are available in sandwich and can be plugged into the inference functions mentioned above.
  • Nonnested model comparisons : Various tests for comparing non-nested linear models are available in lmtest (encompassing test, J test, Cox test). The Vuong test for comparing other non-nested models is provided by nonnest2 (and specifically for count data regression in pscl).
  • Diagnostic checking : The packages car and lmtest provide a large collection of regression diagnostics and diagnostic tests.