Description Usage Arguments Value Author(s) See Also Examples
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.
1 | hmmcontSimul(hmm, n)
|
hmm |
An object of the class ContObservHMM |
n |
Number of observations to be simulated. |
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.
Mikhail A. Beketov
Functions: hmmsetcont
,
baumwelchcont
, and
viterbicont
.
1 2 3 4 5 6 7 8 9 10 11 | 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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.