R: Simulation of an observation and underlying Markov processes...
hmmcontSimul
R Documentation
Simulation of an observation and underlying Markov processes according to a given model
Description
The function simulates (i) two observation processes that correspond to the distributions of the two states in an HMM, (ii) the underlying Markov process, and (iii) an observation process that correspond to an HMM in terms of both the underlying Markov and observations processes. The function uses the last-iteration parameters, when the HMM-object was modified by function baumwelchcont previously.
Usage
hmmcontSimul(hmm, n)
Arguments
hmm
An object of the class ContObservHMM
n
Number of observations to be simulated.
Value
The function returns an object of the class SimulContHMM that is a list comprising the two observations processes (each corresponds to the distribution of one of the two states), the Markov chain (i.e. the underlying process consisting of two states), and the observation process that correspond to that Markov chain and the two distributions. Hence, the latter is the process simulated according a given HMM.
Author(s)
Mikhail A. Beketov
See Also
Functions: hmmsetcont,
baumwelchcont, and
viterbicont.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(HMMCont)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HMMCont/hmmcontSimul.Rd_%03d_medium.png", width=480, height=480)
> ### Name: hmmcontSimul
> ### Title: Simulation of an observation and underlying Markov processes
> ### according to a given model
> ### Aliases: hmmcontSimul
> ### Keywords: Simulation Hidden Markov Model
>
> ### ** Examples
>
>
> Returns<-(logreturns(Prices))*10
> hmm<-hmmsetcont(Returns)
> for(i in 1:6){hmm<-baumwelchcont(hmm)}
> hmmcomplete<-viterbicont(hmm)
>
> sim<-hmmcontSimul(hmmcomplete, n=100) # simulating the processes
>
> plot(sim$StateProcess1, type="l", ylab="State 1 Process")
> plot(sim$StateProcess2, type="l", ylab="State 2 Process")
> plot(sim$MarkovChain, type="l", ylab="Markov chain")
> plot(sim$SimulatedObservation, type="l", ylab="Full HMM Process")
>
>
>
>
>
> dev.off()
null device
1
>