R/simule_MC.R

Defines functions simule_MC

Documented in simule_MC

simule_MC <-
function(transmat,prior,T) {

y = matrix(0,1,T)
y[1] = which(rmultinom(1, size = 1, prob = prior)==1)
for(i in 2:T) {
y[i]=which(rmultinom(1, size = 1, prob = transmat[y[i-1], ])==1)
}
return(y)
}

Try the NHMSAR package in your browser

Any scripts or data that you put into this service are public.

NHMSAR documentation built on Feb. 9, 2022, 9:06 a.m.