Learn R Programming

CDM (version 2.7-7)

anova.din: Likelihood Ratio Test for Model Comparisons

Description

This function compares two models estimated with din, gdina or gdm using a likelihood ratio test.

Usage

## S3 method for class 'din':
anova(object,object1,\dots)

## S3 method for class 'gdina':
anova(object,object1,\dots)

## S3 method for class 'gdm':
anova(object,object1,\dots)

Arguments

object
Object of class din, gdina or gdm
object1
Object of class din, gdina or gdm
...
Further arguments to be passed

Examples

Run this code
#############################################################################
# EXAMPLE 1: anova with din objects
#############################################################################

# Model 1
d1 <- din(sim.dina, q.matr = sim.qmatrix )
# Model 2 with equal guessing and slipping parameters
d2 <- din(sim.dina, q.matr = sim.qmatrix , guess.equal=TRUE , slip.equal =TRUE)
# model comparison
anova(d1,d2)
##   > anova(d1,d2)
##       Model   loglike Deviance Npars      AIC      BIC    Chisq df  p
##   2 Model 2 -2176.482 4352.963     9 4370.963 4406.886 268.2071 16  0
##   1 Model 1 -2042.378 4084.756    25 4134.756 4234.543       NA NA NA

#############################################################################
# EXAMPLE 2: anova with gdina objects
#############################################################################

# Model 3: GDINA model
d3 <- gdina( sim.dina, q.matr = sim.qmatrix )

# Model 4: DINA model
d4 <- gdina( sim.dina, q.matr = sim.qmatrix , rule="DINA")

# model comparison
anova(d3,d4)
##   > anova(d3,d4)
##       Model   loglike Deviance Npars      AIC      BIC    Chisq df       p
##   2 Model 2 -2042.378 4084.756    25 4134.756 4234.543 31.45153 16 0.01178
##   1 Model 1 -2026.652 4053.305    41 4135.305 4298.955       NA NA      NA

Run the code above in your browser using DataLab