HMMfit {HMMmlselect} | R Documentation |
HMMfit
Description
The following function performs (a) HMM fitting through the Expectation-Maximization al- gorithm (METHOD = 1), (b) HMM fitting through the Markov chain Monte Carlo algorithm (METHOD = 2), and (c) Gaussian mixture model fitting through the Markov chain Monte Carlo algorithm (METHOD = 3).
Usage
HMMfit(y, K, METHOD, optionalfit = list())
Arguments
y |
The observed data. |
K |
The specified number of states of the underlying Markov chian. |
METHOD |
Integer value indicating the method of parameter estimation: (a) HMM fitting through the Expectation-Maximization al- gorithm (METHOD = 1), (b) HMM fitting through the Markov chain Monte Carlo algorithm (METHOD = 2), and (c) Gaussian mixture model fitting through the Markov chain Monte Carlo algorithm (METHOD = 3) |
optionalfit |
Optional variables as a list. Possible options include: |
Ngibbs: Number of samples when using MCMC. Default is 5000.
Burnin: Length of burnin period when using MCMC. Default is 5000.
Thin: Thinning parameter when using MCMC. Default is 10.
Nstart: Number of starting points. Default is 50.
verbose: Logic variable indicating pritting details or not. Default is
FALSE
.priors: Prior when using MCMC. Default is flat.
Details
See Manual.pdf in "inst/extdata" folder.
Value
This functions returns the fitting parameters of the observed data given the specified number of 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
library(HMMmlselect)
# Example 1: use HMMfit to inference number of states
obs = HMMsim ( n = 200 )$obs
Nest = HMMfit( y = obs, K=3, METHOD = 1)