HMMfit: HMMfit

Description Usage Arguments Details Value References Examples

View source: R/HMMorderselectionfacility.R

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

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

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

1
2
3
4
5
library(HMMmlselect)

# Example 1: use HMMfit to inference number of states
obs = HMMsim ( n = 200 )$obs
Nest = HMMfit( y = obs, K=3, METHOD = 1)

Example output

begin Baum Welch
Baum-Welch	 Results:
0.948617	2.128402	3.077285	
0.086997	0.149623	0.080536	
0.282187	0.320598	0.397215	
0.311743	0.434483	0.253773	
0.257478	0.490784	0.251737	
LL -232.027760;	 s2:
0.122018	0.122018	0.122018	

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