Learn R Programming

HMMmlselect (version 0.1.6)

HMMsim: HMMsim

Description

This function simulates HMM with the observed data being conditionally Gaussian distributed given the underlying state.

Usage

HMMsim(n, optionalsim = list())

Arguments

n

The length of HMM to be simulated.

optionalsim

Optional variables as a list. Possible options include:

Value

It returns the sample of the simulated HMM.

Details

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

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

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

Run the code above in your browser using DataLab