Compute AIC value for a list of hmm and hidden Markov models

1 |

`...` |
objects created by ‘hmmm.mlfit’ or ‘hidden.emfit’ |

`LRTEST` |
If TRUE, the first model must include all the others models as special cases. For every model, the likelihood ratio statistic test with respect to the first model is computed |

`ORDERED` |
If TRUE, in the output the models are ordered according to the Akaike criterium starting from the lowest AIC value |

`NAMES` |
Optional character vector with the names of the models. If it is NULL (the default) model names are created as model1, model2..... |

The models in input must be at least two objects of the classes `hmmmfit`

or `hidden`

.

A matrix with row names given by `NAMES`

and column names describing the
output for every model (position of the model in the input list `#model`

,
the loglikelihood function `loglik`

, the number of parameters `npar`

,
the number of constraints of the model `dfmodel`

, likelihood ratio test `LRTEST`

, degrees of freedom `dftest`

, `PVALUE`

, `AIC`

, `DELTAAIC`

). The `DELTAAIC`

is the difference between the AIC value of every model and the lowest AIC value.

Konishi S, Kitagawa G (2008) Information criteria and statistical modeling. Springer.

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 26 27 28 | ```
data(madsen)
# 1 = Influence; 2 = Satisfaction; 3 = Contact; 4 = Housing
names<-c("Inf","Sat","Co","Ho")
y<-getnames(madsen,st=6)
margin <- marg.list(c("marg-marg-l-l", "g-marg-l-l", "marg-g-l-l", "g-g-l-l"))
# additive effect of 3 and 4 on logits of 1 in marginal
# distribution {1, 3, 4}, conditional independence 2_||_3|4
modelA <- hmmm.model(marg = margin, lev = c(3, 3, 2, 4), names = names)
modA <- hmmm.mlfit(y, modelA)
modA
# additive effect of 3 and 4 on logits of 1 in marginal
# distributions {1, 3, 4} and {2, 3, 4}
modelB <- hmmm.model(marg = margin, lev = c(3, 3, 2, 4),
names = names, sel = c(18:23, 34:39))
modB <- hmmm.mlfit(y, modelB)
modB
# 1 and 2 do not depend on the levels of 3 and 4
modelC <- hmmm.model(marg = margin, lev = c(3, 3, 2, 4),
names = names, sel = c(18:23, 34:39, 44:71))
modC <- hmmm.mlfit(y, modelC)
modC
akaike(modB, modA, modC, ORDERED = TRUE, NAMES = c("modB", "modA", "modC"))
akaike(modB, modA, modC, LRTEST = TRUE, NAMES = c("modB", "modA", "modC"))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.