Simulate data distributed according to oHMMed with normal emission densities
Source:R/MCMC_normal.R
hmm_simulate_normal_data.Rd
Simulate data distributed according to oHMMed with normal 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_T0 <- 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
means0 <- c(-1,0,1)
sigma0 <- 1
sim_data <- hmm_simulate_normal_data(L = L,
mat_T = mat_T0,
means = means0,
sigma = sigma0)
plot(density(sim_data$data), main = "Density of Simulated Normal Data")
sim_data
#> $data
#> [1] -0.06864381 -3.52368000 -0.26801732 -1.82100090 -1.11234527 -1.42891536
#> [7] -0.32001136 2.19661376 -0.28734881 0.50418329 -0.56098588 -0.78995781
#> [13] -0.71556271 -0.16015369 1.49216131 -1.57180982 -0.73566420 1.04277799
#> [19] -1.07743443 0.57081259 1.97377167 -1.01163052 -0.70553719 0.79925384
#> [25] 0.32294219 0.74904887 0.16590734 -0.65343176 -0.98416503 0.16364040
#> [31] 0.93685363 1.64695220 1.16516140 -0.56124951 -0.38728808 -1.24761866
#> [37] -0.06821972 -2.07662407 -0.08556544 -2.34239847 -1.40870352 -0.24489081
#> [43] 0.05579589 -0.58992833 -1.08932963 -0.15785072 1.60267101 -0.24672514
#> [49] 0.62279916 -0.75373738 -0.18716072 -0.46718535 -0.04951256 1.48998726
#> [55] 0.25838011 -1.34872803 -0.58619822 -0.59120157 0.39377320 0.35538519
#> [61] -0.52964962 1.11280893 0.80504476 -1.84203046 -0.57520477 0.83992653
#> [67] -1.22094483 -0.24063909 -0.89528027 -2.01216892 -1.87995892 -0.07418819
#> [73] -1.60831759 -0.62135704 -2.48994977 -1.29551415 -0.83745039 -2.22804403
#> [79] -1.07123827 -1.09225574 -0.95110838 -2.07033987 -1.26392179 -0.81904785
#> [85] 0.71105378 -0.02091522 -2.22040639 0.53415880 -2.51269548 -0.20257148
#> [91] -2.16915431 0.36747742 0.05930010 -0.79773002 -1.60113573 -1.66390738
#> [97] -1.92386162 -1.45795126 -1.05795807 -1.80692064 -2.35199888 -2.94379693
#> [103] -1.03045446 -0.57521002 -2.65885216 0.08131543 -1.20078062 -0.78831543
#> [109] 0.62809542 -1.66606811 -1.31006712 -0.31413213 -2.08066035 -1.97584998
#> [115] -1.61461344 -0.91449988 -1.95952440 -0.35792333 -3.04353756 -1.25287248
#> [121] 0.19179717 -1.12988155 -0.85175299 -2.73620340 -2.57813407 -1.55311971
#> [127] -1.11843851 -0.62378240
#>
#> $states
#> [1] 1 1 1 1 1 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 2 2 1
#> [38] 1 1 1 1 1 1 1 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 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
#>