markov_loop: Inner Markov Loop in base R

Description Usage Arguments Value Examples

View source: R/markov_loop.R

Description

Inner Markov Loop in base R

Usage

1
markov_loop(sim = NULL, cohort, transition = NULL, duration = NULL)

Arguments

sim

Matrix with the same number of rows as the duration of the model and the same number of columns as the number of states in the model.

cohort

A vector containing the initial state.

transition

A transition matrix, see example_two_state_markov for an example of setting this up.

duration

Numeric, how many long to run the model for.

Value

A matrix of the same size as the inputted sim matrix.

Examples

1
2
3
4
5
6
7
 
transition <- matrix(rnorm(4), 2, 2)
sim <- matrix(NA, 10, 2)
cohort <- c(1, 0)
duration <- 10
 
markov_loop(sim, cohort, transition, duration)

seabbs/SpeedyMarkov documentation built on Dec. 26, 2019, 4:38 a.m.