Learn R Programming

nonnest2 (version 0.2)

vuongtest: Vuong Tests for Model Comparison

Description

Test pairs of models using Vuong's (1989) theory. This includes a test of model distinguishability and a test of model fit.

Usage

vuongtest(object1, object2, nested = FALSE, adj = "none")

Arguments

object1
a model object
object2
a model object
nested
if TRUE, models are assumed to be nested
adj
Should an adjusted test statistic be calculated? Defaults to none, with possible adjustments being aic and bic

Value

  • an object of class vuongtest containing test results.

Details

For non-nested models, the test of distinguishability indicates whether or not the models can possibly be distinguished on the basis of the observed data. The LRT then indicates whether or not one model fits better than another.

For nested models (nested=TRUE), both tests serve as robust alternatives to the classical likelihood ratio tests. In this case, the adj argument is ignored.

Users should take care to ensure that the two models have the same dependent variable (or, for lavaan objects, identical modeled variables), with observations ordered identically within each model object. Assuming the same data matrix is used to fit each model, observation ordering should generally be identical. There are currently no checks for this, however.

References

Vuong, Q. H. (1989). Likelihood ratio tests for model selection and non-nested hypotheses. Econometrica, 57, 307-333.

Merkle, E. C., You, D., & Preacher, K. (2014). Testing non-nested structural equation models. Manuscript under review.

Examples

Run this code
## Count regression comparisons
require(MASS)
house1 <- glm(Freq ~ Infl + Type + Cont, family=poisson, data=housing)
house2 <- glm(Freq ~ Infl + Sat, family=poisson, data=housing)
house3 <- glm(Freq ~ Infl, family=poisson, data=housing)
## house3 is nested within house1 and house2
anova(house3, house1, test="Chisq")
anova(house3, house2, test="Chisq")

## house 2 is not nested in house1, so this test is invalid
anova(house2, house1, test="Chisq")

## Use vuongtest() instead
vuongtest(house2, house1)

## Application to models with different distributional assumptions
require(pscl)
bio1 <- glm(art ~ fem + mar + phd + ment, family=poisson, data=bioChemists)
bio2 <- hurdle(art ~ fem + mar + phd + ment, data=bioChemists)
bio3 <- zeroinfl(art ~ fem + mar + phd + ment, data=bioChemists)
vuongtest(bio2, bio1)
vuongtest(bio3, bio1)
vuongtest(bio1, bio2)
vuongtest(bio1, bio3)
vuongtest(bio3, bio2)

## Application to latent variable models
require(lavaan)
HS.model <- 'visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '
fit1 <- cfa(HS.model, data=HolzingerSwineford1939)
fit2 <- cfa(HS.model, data=HolzingerSwineford1939, group="school")
vuongtest(fit1, fit2)

Run the code above in your browser using DataLab