Learn R Programming

CDM (version 7.4-19)

anova: 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 din
anova(object,…)

# S3 method for gdina anova(object,…)

# S3 method for gdm anova(object,…)

# S3 method for mcdina anova(object,…)

# S3 method for reglca anova(object,…)

# S3 method for slca anova(object,…)

Arguments

object

Two objects of class din, gdina, mcdina, slca, gdm, reglca

Further arguments to be passed

See Also

din, gdina, gdm, mcdina, slca

Examples

Run this code
# NOT RUN {
#############################################################################
# EXAMPLE 1: anova with din objects
#############################################################################

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

# }
# NOT RUN {
#############################################################################
# EXAMPLE 2: anova with gdina objects
#############################################################################

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

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

# model comparison
anova(d3,d4)
  ##     Model   loglike Deviance Npars      AIC      BIC    Chisq df       p
  ##   2    d4 -2042.293 4084.586    25 4134.586 4234.373 31.31995 16 0.01224
  ##   1    d3 -2026.633 4053.267    41 4135.266 4298.917       NA NA      NA
# }

Run the code above in your browser using DataLab