Learn R Programming

hmmm (version 1.0-4)

akaike: akaike criterium

Description

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

Usage

akaike(..., LRTEST = FALSE, ORDERED = FALSE, NAMES = NULL)

Arguments

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.....

Value

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.

Details

The models in input must be at least two objects of the classes hmmmfit or hidden.

References

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

Examples

Run this code
# NOT RUN {
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"))
# }

Run the code above in your browser using DataLab