anova.hidden: anova for the class hidden

Description Usage Arguments Details See Also Examples

Description

The generic function ‘anova’ is adapted to the objects inheriting from class hidden (anova.hidden) to compute the likelihood ratio test for nested hidden models estimated by ‘hidden.emfit’.

Usage

1
2
## S3 method for class 'hidden'
anova(object,objectlarge,...)

Arguments

object

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

objectlarge

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

...

Other models and further arguments passed to or from other methods

Details

Nested models, fitted by ‘hidden.emfit’, 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

hidden.emfit, summary.hidden, print.hidden

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
data(drinks)
y<-cbind(drinks$lemon.tea,drinks$orange.juice)

f<-~lat*tea+lat*juice+tea*juice  # lat indicates the latent variable
fm<-c("l-l-l")
fmargobs<-marg.list(fm,mflag="m")
Ptr<-matrix(c(0.941, 0.199,
               0.059, 0.801),2,2,byrow=TRUE)
Ptobs<-matrix(c(0.053, 0.215, 0.206, 0.001, 0.039, 0.021, 0.020, 0.176, 0.270,
                0.000, 0.000, 0.000, 0.048, 0.263, 0.360, 0.065, 0.053, 0.211)
                ,2,9,byrow=TRUE)

# saturated model (fsat<-~lat*tea*juice is implicit)
model.obsf<-hmmm.model(marg=fmargobs,
lev=c(2,3,3),names=c("lat","tea","juice"))
modelsat<-hidden.emfit(y,model.obsf,y.eps=0.01,maxit=10,
maxiter=2500,norm.diff.conv=0.001,old.tran.p=Ptr,bb=Ptobs)

# model with constant association
model.coass<-hmmm.model(marg=fmargobs,
lev=c(2,3,3),names=c("lat","tea","juice"),formula=f)
modelca<-hidden.emfit(y,model.coass,y.eps=0.01,maxit=10,
maxiter=2500,norm.diff.conv=0.001,old.tran.p=Ptr,bb=Ptobs)

a<-anova(modelca,modelsat)

hmmm documentation built on May 2, 2019, 12:27 p.m.