anova.eglhmm: Test for a difference between two fitted 'eglhmm' models.

View source: R/anova.eglhmm.R

anova.eglhmmR Documentation

Test for a difference between two fitted eglhmm models.

Description

Apply a likelihood ratio test to determine whether the difference, between the log likelihood statistics of two fitted eglhmm models, is statistically significant.

Usage

## S3 method for class 'eglhmm'
anova(object, ...)

Arguments

object

An object of class "eglhmm" as returned by eglhmm().

...

Precisely one more object of class "eglhmm", to be compared with object.

Details

This anova method handles only comparisons between two models.) The order of the arguments (i.e. which object is passed as “object” and which is passed as the sole entry of the ... argument) is immaterial.

Value

A list with components

  • stat the likelihood ratio statistic, i.e. the difference between the log likelihoods of the two models. That for the model with the smaller number of parameters is subtracted from that for the model with the larger number.

  • df the degrees of freedom of the likelihood ratio statistic, i.e. the difference between the number of parameters of the respective models. The smaller number is subtracted from the larger.

  • pvalue the p-value of the test as given by pchisq(stat, df, lower.tail = FALSE).

This list has an attribute "details" consisting of a numeric vector of length four with entries ll1 (the smaller of the log likelihoods), ll2 (the larger of the log likelihoods), np1 (the smaller of the parameter counts) and np2 (the larger of the parameter counts).

Author(s)

Rolf Turner rolfturner@posteo.net

Examples

fit1 <- eglhmm(formula=y~locn+depth,data=SydColCount,
               cells=c("locn","depth"),distr="P",K=2,
               method="em",verb=TRUE)
fit2 <- eglhmm(formula=y~locn+depth+ma.com+nh.com+bo.com,data=SydColCount,
               cells=c("locn","depth"),distr="P",K=2,
               method="em",verb=TRUE)
anova(fit1,fit2)

eglhmm documentation built on May 29, 2024, 1:20 a.m.

Related to anova.eglhmm in eglhmm...