anova.hmmmfit {hmmm}R Documentation

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 class '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 printed.

Value

A matrix with information about Likelihood ratio tests degree of freedom and P values for the compared models.

See Also

hmmm.mlfit, summary.hmmmfit, print.hmmmfit

Examples

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)

[Package hmmm version 1.0-5 Index]