sim_x_kn: Simulate a processus from an heterogeneuous markov chain....

View source: R/RcppExports.R

sim_x_knR Documentation

Simulate a processus from an heterogeneuous markov chain. This heterogeneous markov Chain is the low of the state of an HMM given the obervation.

Description

Simulate a processus from an heterogeneuous markov chain. This heterogeneous markov Chain is the low of the state of an HMM given the obervation.

Usage

sim_x_kn(m, alpha, beta, A, Pi, f0x, f1x)

Arguments

alpha

a matrix m * 2 containing the forward variables

beta

a matrix m * 2 containing the backward variables

A

a matrix 2 * 2 the transition probabilities

Pi

vector of the initial state probabilities for each state.

f0x

a vector of the values of the density under the null hypothesis on the observations

f1x

a vector of the values of the density under the alternative hypothesis on the observations

Value

Product of matrices

Examples

 m <-  10
 A <- matrix(c(0.95, 0.05, 0.2, 0.80), 2, 2, byrow = T)
 f0 <- c(0, 1)
 f1 <- c(2, 1)
 Pi <- c( 0.9, 0.1)
 rdata <- simulate.data.hmm.2states(m, Pi, A, f0, f1)
 x <- rdata$x
 theta <- rdata$theta
 mod <- for_back(m, A, f0x, f1x, Pi)
 f0x <- dnorm(x, f0[1], f0[2])
 f1x <- dnorm(x, f1[1], f1[2])
 alpha <- mod$alpha
 beta <- mod$beta
 sim_x_kn(m, alpha, beta, A, Pi, f0x, f1x)

Marie-PerrotDockes/sanssouci.hmm documentation built on Oct. 26, 2023, 10:36 a.m.