Learn R Programming

heemod (version 0.3.0)

eval_model: Evaluate Markov Model

Description

Given an unevaluated Markov Model, an initial number of individual and a number of cycle to compute, returns the evaluated version of the objects and the count of individual per state per model cycle.

Usage

eval_model(model, cycles, init, method)

Arguments

model
An uneval_model object.
cycles
positive integer. Number of Markov Cycles to compute.
init
numeric vector, same length as number of model states. Number of individuals in each model state at the beginning.
method
Counting method.

Value

  • An eval_model object (actually a list of evaluated parameters, matrix, states and cycles counts).

Details

init need not be integer. E.g. specifying a vector of type c(Q = 1, B = 0, C = 0, ...) returns the probabilities for an individual starting in state A to be in each state, per cycle.

Examples

Run this code
param <- define_parameters(
  a = markov_cycle + 1 * 2
)

mat <- define_matrix(
  1-1/a, 1/a,
  .1,    .9
)

sta <- define_state_list(
  A = define_state(cost = 10),
  B = define_state(cost = 2)
)

mod <- define_model(
  parameters = param,
  transition_matrix = mat,
  states = sta
)

eval_model(
  mod,
  init = c(10, 5),
  cycles = 5
)

Run the code above in your browser using DataLab