Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

coxtest

Cox Test for Comparing Non-Nested Models


Description

coxtest performs the Cox test for comparing two non-nested models.

Usage

coxtest(formula1, formula2, data = list())

Arguments

formula1

either a symbolic description for the first model to be tested, or a fitted object of class "lm".

formula2

either a symbolic description for the second model to be tested, or a fitted object of class "lm".

data

an optional data frame containing the variables in the model. By default the variables are taken from the environment which coxtest is called from.

Details

The idea of the Cox test is the following: if the first model contains the correct set of regressors, then a fit of the regressors from the second model to the fitted values from first model should have no further explanatory value. But if it has, it can be concluded that model 1 does not contain the correct set of regressors.

Hence, to compare both models the fitted values of model 1 are regressed on model 2 and vice versa. A Cox test statistic is computed for each auxiliary model which is asymptotically standard normally distributed.

For further details, see the references.

Value

An object of class "anova" which contains the estimate plus corresponding standard error, z test statistic and p value for each auxiliary test.

References

R. Davidson & J. MacKinnon (1981). Several Tests for Model Specification in the Presence of Alternative Hypotheses. Econometrica, 49, 781-793.

W. H. Greene (1993), Econometric Analysis, 2nd ed. Macmillan Publishing Company, New York.

W. H. Greene (2003). Econometric Analysis, 5th ed. New Jersey, Prentice Hall.

See Also

Examples

## Fit two competing, non-nested models for aggregate 
## consumption, as in Greene (1993), Examples 7.11 and 7.12

## load data and compute lags
data(USDistLag)
usdl <- na.contiguous(cbind(USDistLag, lag(USDistLag, k = -1)))
colnames(usdl) <- c("con", "gnp", "con1", "gnp1")

## C(t) = a0 + a1*Y(t) + a2*C(t-1) + u
fm1 <- lm(con ~ gnp + con1, data = usdl)

## C(t) = b0 + b1*Y(t) + b2*Y(t-1) + v
fm2 <- lm(con ~ gnp + gnp1, data = usdl)

## Cox test in both directions:
coxtest(fm1, fm2)

## ...and do the same for jtest() and encomptest().
## Notice that in this particular case they are coincident.
jtest(fm1, fm2)
encomptest(fm1, fm2)

lmtest

Testing Linear Regression Models

v0.9-38
GPL-2 | GPL-3
Authors
Torsten Hothorn [aut] (<https://orcid.org/0000-0001-8301-0471>), Achim Zeileis [aut, cre] (<https://orcid.org/0000-0003-0918-3766>), Richard W. Farebrother [aut] (pan.f), Clint Cummins [aut] (pan.f), Giovanni Millo [ctb], David Mitchell [ctb]
Initial release
2020-09-09

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.