Learn R Programming

heemod (version 0.3.3)

run_newdata: Iteratively Run Markov Models Over New Parameter Sets (Heterogeneity or Probabilistic analysis)

Description

Given a table of new parameter values with a new parameter set per line, runs iteratively Markov models over these sets.

Usage

run_newdata(x, newdata)

Arguments

x
The result of run_models.
newdata
A data.frame of new parameter sets, one column per parameter and one row per parameter set. Can be prespecified for heterogeneity analysis or randomly drawn with resample for probability analysis.

Value

A data.frame with one row per model/value.

Examples

Run this code
mod1 <-
  define_model(
    transition_matrix = define_matrix(
      .5, .5,
      .1, .9
    ),
    define_state(
      cost = 543 + age * 5,
      ly = 1
    ),
    define_state(
      cost = 432 + age,
      ly = 1
    )
    
  )

mod2 <-
  define_model(
    transition_matrix = define_matrix(
      .5, .5,
      .1, .9
    ),
    define_state(
      cost = 789 * age / 10,
      ly = 1
    ),
    define_state(
      cost = 456 * age / 10,
      ly = 1
    )
    
  )

res2 <- run_models(
  mod1, mod2,
  parameters = define_parameters(
    age_init = 60,
    age = age_init + markov_cycle
  ),
  init = 1:0,
  cycles = 10,
  cost = cost,
  effect = ly
)
# generating table with new parameter sets
new_tab <- data.frame(
  age_init = 40:80
)

# with run_model result
ndt1 <- run_newdata(res2, newdata = new_tab)

Run the code above in your browser using DataLab