Simulate data distributed according to oHMMed with gamma-poisson emission densities
Source:R/MCMC_poisson.R
hmm_simulate_gamma_poisson_data.Rd
Simulate data distributed according to oHMMed with gamma-poisson emission densities
Value
Returns a list with the following elements:
data
: numeric vector with datastates
: an integer vector with "true" hidden states used to generate the data vectorpi
: numeric vector with prior probability of states
Examples
mat_T <- rbind(c(1-0.01, 0.01, 0),
c(0.01, 1-0.02, 0.01),
c(0, 0.01, 1-0.01))
L <- 2^7
betas <- c(0.1, 0.3, 0.5)
alpha <- 1
sim_data <- hmm_simulate_gamma_poisson_data(L = L,
mat_T = mat_T,
betas = betas,
alpha = alpha)
hist(sim_data$data,
breaks = 40,
main = "Histogram of Simulated Gamma-Poisson Data",
xlab = "")
sim_data
#> $data
#> [1] 0 12 0 7 0 0 0 5 2 0 2 1 1 2 1 4 0 4 2 2 4 1 6 2 3
#> [26] 0 3 6 5 7 15 2 2 14 1 7 7 12 0 1 1 5 1 0 5 3 3 0 1 1
#> [51] 6 4 4 1 5 1 6 6 0 5 2 3 0 2 4 2 4 22 22 1 1 4 2 5 9
#> [76] 3 18 4 2 1 0 30 0 3 8 16 20 4 1 4 23 24 19 2 3 6 6 0 38 3
#> [101] 7 81 4 1 1 5 34 2 5 6 7 19 0 1 13 0 33 6 8 5 15 12 6 15 7
#> [126] 3 15 5
#>
#> $states
#> [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 2 2 2
#> [38] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1
#> [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> Levels: 1 2 3
#>
#> $pi
#> [1] 0.3333333 0.3333333 0.3333333
#>