akaike: akaike criterium

Description Usage Arguments Details Value References Examples

View source: R/hidden.R

Description

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

Usage

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

Details

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

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.

References

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

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
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"))

hmmm documentation built on May 29, 2017, 6:20 p.m.

Search within the hmmm package
Search all R packages, documentation and source code