get_A | R Documentation |
Simple matrix multiplication
get_A(m, alpha, beta, A, f0x, f1x, i)
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. |
Product of matrices
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)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.