Description Usage Arguments Value References Examples
Simulate a hidden Markov series and its underlying states with zero-inflated emission distributions
1 | hmmsim.cont(n, M, prior, tpm_parm, emit_parm, zeroprop, timeindex)
|
n |
length of the simulated series |
M |
number of hidden states |
prior |
a vector of prior probability for each state |
tpm_parm |
transition rate matrix |
emit_parm |
a vector containing means for each poisson distribution |
zeroprop |
a vector containing structural zero proportions in each state |
timeindex |
a vector containing the time points |
simulated series and corresponding states
Walter Zucchini, Iain L. MacDonald, Roland Langrock. Hidden Markov Models for Time Series: An Introduction Using R, Second Edition. Chapman & Hall/CRC
1 2 3 4 5 6 7 8 | prior_init <- c(0.5,0.2,0.3)
emit_init <- c(10,40,70)
zero_init <- c(0.5,0,0)
omega <- matrix(c(-0.3,0.2,0.1,0.1,-0.2,0.1,0.2,0.2,-0.4),3,3,byrow=TRUE)
timeindex <- rep(1,1000)
for(i in 2:1000) timeindex[i] <- timeindex[i-1] + sample(1:3,1)
result <- hmmsim.cont(n=1000,M=3,prior=prior_init, tpm_parm=omega,
emit_parm=emit_init,zeroprop=zero_init,timeindex=timeindex)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.