| anova.eglhmm {eglhmm} | R 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 |
... |
Precisely one more object of class |
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
-
statthe 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. -
dfthe 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. -
pvaluethep-value of the test as given bypchisq(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)