Learn R Programming

TAM (version 4.2-21)

anova-logLik: Likelihood Ratio Test for Model Comparisons and Log-Likelihood Value

Description

The anova function compares two models estimated of class tam, tam.mml or tam.mml.3pl using a likelihood ratio test. The logLik function extracts the value of the log-Likelihood.

The function can be applied for values of tam.mml, tam.mml.2pl, tam.mml.mfr, tam.fa, tam.mml.3pl, tam.latreg or tamaan.

Usage

# S3 method for tam
anova(object, ...)
# S3 method for tam
logLik(object, ...)

# S3 method for tam.mml anova(object, ...) # S3 method for tam.mml logLik(object, ...)

# S3 method for tam.mml.3pl anova(object, ...) # S3 method for tam.mml.3pl logLik(object, ...)

# S3 method for tamaan anova(object, ...) # S3 method for tamaan logLik(object, ...)

# S3 method for tam.latreg anova(object, ...) # S3 method for tam.latreg logLik(object, ...)

# S3 method for tam.np anova(object, ...) # S3 method for tam.np logLik(object, ...)

Value

A data frame containing the likelihood ratio test statistic and information criteria.

Arguments

object

Object of class tam, tam.mml, tam.mml.3pl, tam.latreg, tam.np, or tamaan. Note that for anova two objects (fitted models) must be provided.

...

Further arguments to be passed

Examples

Run this code
#############################################################################
# EXAMPLE 1: Dichotomous data sim.rasch - 1PL vs. 2PL model
#############################################################################

data(data.sim.rasch)
# 1PL estimation
mod1 <- TAM::tam.mml(resp=data.sim.rasch)
logLik(mod1)
# 2PL estimation
mod2 <- TAM::tam.mml.2pl(resp=data.sim.rasch, irtmodel="2PL")
logLik(mod2)
# Model comparison
anova( mod1, mod2 )
  ##     Model   loglike Deviance Npars      AIC      BIC    Chisq df       p
  ##   1  mod1 -42077.88 84155.77    41 84278.77 84467.40 54.05078 39 0.05508
  ##   2  mod2 -42050.86 84101.72    80 84341.72 84709.79       NA NA      NA

if (FALSE) {
#############################################################################
# EXAMPLE 2: Dataset reading (sirt package): 1- vs. 2-dimensional model
#############################################################################

data(data.read, package="sirt")

# 1-dimensional model
mod1 <- TAM::tam.mml.2pl(resp=data.read )
# 2-dimensional model
mod2 <- TAM::tam.fa(resp=data.read, irtmodel="efa", nfactors=2,
             control=list(maxiter=150) )
# Model comparison
anova( mod1, mod2 )
  ##       Model   loglike Deviance Npars      AIC      BIC    Chisq df  p
  ##   1    mod1 -1954.888 3909.777    24 3957.777 4048.809 76.66491 11  0
  ##   2    mod2 -1916.556 3833.112    35 3903.112 4035.867       NA NA NA
}

Run the code above in your browser using DataLab