Description Usage Arguments Value References Examples
Simulate a continuous-time hidden Markov series and its underlying states with covariates in state-dependent parameters and transition rates.
1 | hmmsim3.cont(workparm, M, n, zeroindex, x, timeindex)
|
workparm |
working parameters |
M |
number of latent states |
n |
length of the simulated series |
zeroindex |
a vector specifying whether a certain state is zero-inflated |
x |
matrix of covariates for the log poisson means, structural zero proportions and transition rates. |
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 9 10 11 12 13 | priorparm <- 0
tpmparm <- c(-2,0.1,-0.1,-2,0.2,-0.2)
zeroindex <- c(1,0)
zeroparm <- c(0,-1,1)
emitparm <- c(2,0.5,-0.5,3,0.3,-0.2)
workparm <- c(priorparm,tpmparm,zeroparm,emitparm)
timeindex <- rep(1,1000)
for(i in 2:1000) timeindex[i] <- timeindex[i-1] + sample(1:4,1)
designx <- matrix(rnorm(2000),nrow=1000,ncol=2)
result <- hmmsim3.cont(workparm,2,1000,zeroindex,x=designx,timeindex=timeindex)
y <- result$series
state <- result$state
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.