Description Usage Arguments Details Value References Examples
View source: R/HMMorderselectionfacility.R
This function simulates HMM with the observed data being conditionally Gaussian distributed given the underlying state.
1 |
n |
The length of HMM to be simulated. |
optionalsim |
Optional variables as a list. Possible options include: |
Ksim: Number of states of the simulated HMM. Default is 3
.
P: The transition matrix of the underlying Markov chain. Default is a flat K-by-K matrix.
mu: The mean of the observed data given each underlying state. Default is {1, 2, ..., K}.
sigma: The standard deviation of the observed data given each underlying state. Default is {0.1, 0.1, ... 0.1}.
pi: The distribution of the initial state. Default is an uniform distribution across all possible states.
BoolWritetoFile: Logic variable indicating whether to write the result into file or not. Default is FALSE
.
Filenameoutput: The output file name for the simulated HMM. Default is "HMMtrace.txt".
See Manual.pdf in "inst/extdata" folder.
It returns the sample of the simulated HMM.
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.
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 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.