get_A: Simple matrix multiplication

View source: R/RcppExports.R

get_AR Documentation

Simple matrix multiplication

Description

Simple matrix multiplication

Usage

get_A(m, alpha, beta, A, f0x, f1x, i)

Arguments

m

the number of positions (hypothesis)

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

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

i

the position (hypothesis) for wich we want the posterior transition matrix.

Value

Product of matrices

Examples

m <-  100
A <- matrix(c(0.95, 0.05, 0.2, 0.80), 2, 2, byrow = T)
  rdata <- sim_hmm_2states(m, Pi, A, f0 = c(0,1), f1= c(2,1))
 x <- rdata$x
 f0x <- dnorm(x)
 f1x <- dnorm(x, 1,2)
  mod <- for_back(m, A, f0x, f1x, Pi)
    Pis_est <- lapply(2:m, function(i){
 get_A( m,alpha = mod$alpha, beta = mod$beta, A, f0x, 
        f1x, i = i)
 })
Pis_est2 <- lapply(2:m, function(i){
 get_A_old( m,alpha = mod$alpha, beta = mod$beta, A, f0x, 
        f1x, i = i)
 })

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