#' Converts a transition matrix into a 'cumulative transition matrix'
#' If A is a matrix, the rows of the cumulative A are the cumulative
#' sums of the rows of A
#' This helps in the computation of the probability of an event happening
#' @param transition_matrix The transition matrix for the Markov model, a table
#' @return A table that is the cumulative version of the input table
#' @export
cumulate_matrix <- function(transition_matrix)
{
cum_matrix <- t(apply(transition_matrix, 1, cumsum))
return(cum_matrix)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.