Learn R Programming

hmmm (version 1.0-4)

anova.hmmmfit: anova for the class hmmmfit

Description

The generic function `anova' is adapted to the objects inheriting from class hmmmfit (anova.hmmmfit) to compute the likelihood ratio test for nested hmm models estimated by `hmmm.mlfit'.

Usage

# S3 method for hmmmfit
anova(object,objectlarge,...)

Arguments

object

Object of the class hmmmfit, reduced model, i.e. modelA

objectlarge

Object of the class hmmmfit, large model, i.e. modelB

Other models and further arguments passed to or from other methods

Details

Nested models, fitted by `hmmm.mlfit', are compared (e.g. modelA is nested in modelB), the likelihood ratio statistic with the degrees of freedom and the associated pvalue is returned.

See Also

hmmm.mlfit, summary.hmmmfit, print.hmmmfit

Examples

Run this code
# NOT RUN {
data(madsen)
y<-getnames(madsen)
names<-c("Infl","Sat","Co","Ho")

fA<-~Co*Ho+Sat*Co+Sat*Ho
modelA<-loglin.model(lev=c(3,3,2,4),formula=fA,names=names)
fB<-~Co*Ho+Sat*Co+Infl*Co+Sat*Ho+Infl*Sat
modelB<-loglin.model(lev=c(3,3,2,4),formula=fB,names=names)

modA<-hmmm.mlfit(y,modelA)
modB<-hmmm.mlfit(y,modelB)

anova(modA,modB)
# }

Run the code above in your browser using DataLab