Testing Linear Regression Models

A collection of tests, data sets, and examples for diagnostic checking in linear regression models. Furthermore, some generic tools for inference in parametric models are provided.


Changes in Version 0.9-37

o coeftest() gained a "df" attribute facilitating subsequent processing of its output, e.g., for computing the corresponding confidence intervals. Suggested by Alex Hayes in https://github.com/tidymodels/broom/issues/663.

o Based on the new "df" attribute of "coeftest" objects, a method for confint() is added. confint(coeftest(object, ...)) should match the output of coefci(object, ...).

o Based on the new "df" attribute of "coeftest" objects, a method for df.residual() is added. df.residual(coeftest(object, ...)) returns NULL if a normal (rather than t) approximation was used in coeftest(object, ...) even if df.residual(object) returned something different.

Changes in Version 0.9-36

o resettest() gained a vcov and ... argument that - if present - are passed to waldtest() to carry out the F test. This enables the usage of robust sandwich covariances etc.

o Various documentation improvements suggested by Kevin Tappe.

o Added native routine registration for pan.f.

Changes in Version 0.9-35

o Added a new function coefci() to accompany coeftest() for computing the Wald confidence intervals for coefficients, e.g., based on sandwich covariances.

o The default coeftest() method -- and also coefci() -- now pass the ... arguments on to the vcov.() function argument (if any).

o Fixed bug in bptest() for degrees-of-freedom calculation when some regressors are aliased/collinear. Reported by Amrei Luise Stammann.

o Various documentation improvements suggested by Kevin Tappe.

Changes in Version 0.9-34

o Registered all default methods as S3 methods (in addition to fully exporting them).

o Reference output updated for recent versions of R.

Changes in Version 0.9-33

o Extended license to GPL-2 or GPL-3.

o To make resettest() results numerically more reliable (especially for type = "fitted" when the fitted mean is large), the response is internally scaled.

o The default coeftest() method checks whether coef() and vcov() output has unique names (which they may not have for some model classes, e.g., sampleSelection::selection).

Changes in Version 0.9-32

o Small improvements in residual degrees of freedom computation within default waldtest() method.

o Updated Imports/Suggests to conform with current R CMD check.

Changes in Version 0.9-31

o Included Farebrother/Cummins as "aut" in DESCRIPTION for pan.f Fortran code.

o Made starting values in the auxiliary regression of bgtest() optional. By default still 0, but could also be NA.

o Avoid spurios errors about missing nobs() methods in lrtest().

Changes in Version 0.9-30

o coeftest(), lrtest(), and waldtest() can now also be used for S4 objects provided that methods to the corresponding S4 generics from stats4 are supplied.

o Added output of examples and vignettes as .Rout.save for R CMD check.

o Moved vignette to "vignettes" directory in source package.

Changes in Version 0.9-29

o dwtest() now catches weighted regressions and throws an error because weighted regressions are not supported (yet).

o bgtest() now returns an object of class "bgtest" (inheriting from "htest"). This has coef(), vcov() and df.residual() methods - and thus enable calling coeftest() - to show the results of the auxiliary regression.

Changes in Version 0.9-28

o Fixed typo in print output of dwtest() for two-sided alternatives.

o Fixed problem in coeftest() method for "breakpointsfull" objects (from strucchange). The vcov() method was not called correctly, resulting in an error.

Changes in Version 0.9-27

o Modified grangertest() default method to workaround a bug in as.zoo().

Changes in Version 0.9-26

o added coeftest() method for "mlm" objects (needed for matching coef() output to vcov() method)

Changes in Version 0.9-25

o enhanced documentation for new Rd parser.

Changes in Version 0.9-24

o Added new specification test: PE test for linear vs. log-linear specification in linear regressions is now available as petest().

Changes in Version 0.9-23

o enhanced documentation for new Rd parser.

Changes in Version 0.9-22

o included lmtest.bib in inst/doc for vignette.

o removed \itemize in .Rd files for new R-devel.

Changes in Version 0.9-21

o corrected degrees of freedom for bgtest(..., type = "F") (bug spotted by Oscar Becerra).

Changes in Version 0.9-20

o fixed error in Mandible data. Mandible[158,2] was 34 but should really be 37 (see Table 1 in Royston & Altman 1994). Spotted by Christian Ritz.

Changes in Version 0.9-19

o changed the default behaviour of waldtest.default(): Chisq test (instead of F test) is now used by default which is more sensible for most models (with linear models as a notable exception).

o added waldtest.lm() method that switches the default test back to F test (instead of Chisq test).

Changes in Version 0.9-18

o forgot to export print() method for "coeftest" objects

Changes in Version 0.9-17


o improved dependency declaration in DESCRIPTION

Changes in Version 0.9-16

o updated all .rda data sets to RDX2

o enhanced sanity checking in dwtest()

Changes in Version 0.9-15

o new generic with flexible default method for lrtest(), implementing asymptotic likelihood ratio tests. This works if a logLik() method is provided and suitable methods for updating models and checking consistency.

o simplified print output in coeftest()

Changes in Version 0.9-14

o now a default method for waldtest() is provided (replacing the lm method). It works for "lm", "glm" and "survreg" objects.
Furtheremore, it is object-oriented and generally works if the following methods are available: terms(), formula(), coef() (which needs to be named, matching the names in terms() and vcov()), vcov() (which can alternatively be user-supplied), df.residual(), residuals() and update() (unless only fitted objects are supplied).

o the default coeftest() was enhanced, works now out of the box for "mle" objects, a "survreg" method is added (needed because coef() and vcov() do not necessarily match for "survreg" objects).

o the vcov argument was changed (almost) everywhere to vcov. to avoid name clashes with the vcov() function.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.9-38 by Achim Zeileis, a year ago

Browse source code at https://github.com/cran/lmtest

Authors: Torsten Hothorn [aut] , Achim Zeileis [aut, cre] , Richard W. Farebrother [aut] (pan.f) , Clint Cummins [aut] (pan.f) , Giovanni Millo [ctb] , David Mitchell [ctb]

Documentation:   PDF Manual  

Task views: Econometrics, Empirical Finance, Statistics for the Social Sciences

GPL-2 | GPL-3 license

Imports graphics

Depends on stats, zoo

Suggests car, strucchange, sandwich, dynlm, stats4, survival, AER

Imported by ARDL, BinaryEPPM, CMatching, ConvergenceClubs, Countr, CountsEPPM, DHARMa, DMLLZU, ExPanDaR, FSA, FindIt, GLMpack, GVARX, GWPR.light, ModTools, My.stepwise, OOS, REndo, Seurat, apc, autostsm, betareg, bucky, ceser, chantrics, chipPCR, clusterSEs, conleyreg, cregg, dLagM, describedata, dynamac, dynlm, earlywarnings, ecm, elementR, envalysis, fRegression, fglsnet, forecast, gcmr, georob, glmx, gravity, grf, iClick, interflex, invacost, ivreg, kernelPSI, lmviz, lpirfs, mixpoissonreg, mkin, mlogit, monotonicity, packDAMipd, pdR, plm, prais, promotionImpact, pubh, rcompanion, rddtools, smoothAPC, sovereign, spsur, tradepolicy, trafo, treeclim, vcd.

Depended on by AER, PeerPerformance, UnitStat, cjoint, dcv, erer, fpp, frontier, ivpack, ivregEX, mfx, micEconAids, orcutt, rdd, systemfit, vars.

Suggested by FactorsR, FinTS, MatchIt, NHSRdatasets, POUMM, R2MLwiN, Rchoice, Rcmdr, RcmdrPlugin.IPSUR, Statsomat, broom, bruceR, car, censReg, crch, ctqr, ergmito, finalfit, fxregime, gmnl, huxtable, insight, ivx, meboot, mice, modelsummary, momentfit, multcomp, multiwayvcov, oglmx, pder, performance, pglm, pscl, psychomix, sampleSelection, sandwich, skedastic, spatialreg, strucchange, strucchangeRcpp, subgxe, texreg, vcdExtra, wpa.

Enhanced by stargazer.

See at CRAN