R/updateP.R

Defines functions updateP

Documented in updateP

#' Update transition matrix
#'
#' Update transition matrix
#'
#' @param s Latent state vector
#' @param ns The number of hidden states
#' @param P Transition matrix
#' @param A0 Prior of transition matrix
#' 
#' @return A transtion matrix
#'
#' @export
#'
updateP <- function(s, ns, P, A0){
    swit  <-  switchg(s) 
    for (j in 1:ns){
        swit1 <-  A0[j,] + swit[j,]        
        pj <-  rdirichlet.cp(1, swit1)
        P[j,] <-  pj
    }
    return(P)
}

Try the NetworkChange package in your browser

Any scripts or data that you put into this service are public.

NetworkChange documentation built on March 18, 2022, 7:52 p.m.