HMMmlselect: HMMmlselect

Description Usage Arguments Details Value References Examples

View source: R/HMMorderselectionfacility.R

Description

This function computes the marginal likelihood of the HMM model with the observed data and various number of states, and choose the one with the highest marginal likelihood as the estimated number of states. The method in Chen et al. (2017) is used, which we will denote it as HMMml2017 afterward.

Usage

1
HMMmlselect(y, optionalfit = list())

Arguments

y

The observed data.

optionalfit

Optional variables as a list. Possible options include:

Details

See Manual.pdf in "inst/extdata" folder.

Value

It returns (1) the estimated number of hidden states using the marginal likelihood method, (2) the marginal likelihood values corresponding to 2, 3, ... number of hidden states, and (3) the fitted model parameters given the estimated number of hidden states.

References

Yang Chen, Cheng-Der Fuh, Chu-Lan Kao, and Samuel Kou (2019+) "Determine the number of states in hidden markov models via marginal likelihood." Submitted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(HMMmlselect)

# simulate a 25 observations HMM
obs = HMMsim ( n = 25 )$obs

# perform order selection and estimation
results = HMMmlselect ( y = obs, list(Kfits = c(2,3), boolUseMclust = FALSE) )

# visualize the results, see figure 1
PlotHMM ( y = obs, results )

HMMmlselect documentation built on May 3, 2020, 9:05 a.m.