eval_strategy_newdata: Iteratively Evaluate a Markov Model With New Parameter Values

View source: R/newdata.R

eval_strategy_newdataR Documentation

Iteratively Evaluate a Markov Model With New Parameter Values

Description

Given a data.frame with on set of new parameters values per row, iteratively evaluate the model over the set of new values.

Usage

eval_strategy_newdata(
  x,
  strategy = 1,
  newdata,
  cores = 1,
  create_progress_reporter = create_null_prog_reporter,
  progress_reporter = create_progress_reporter(),
  simplify = F
)

Arguments

x

Result from run_model().

newdata

a data.frame whose names match parameters names. model will be evaluated iteratively, taking successive values from each row.

model

Name or index of model to recompute.

Details

New parameters with a missing value (NA) do not replace existing parameters.

Value

A data.frame containing the values of newdata and each Markov Model evaluation in res.

Examples

par1 <- define_parameters(
  a = 1,
  b = 1 / (markov_cycle + a)
)

mat1 <- define_transition(
  1-b, b,
  0, 1
)
mod1 <- define_strategy(
  transition = mat1,
  define_state(var = a),
  define_state(var = a * markov_cycle)
)

res1 <- run_model(
  mod1,
  parameters = par1,
  cycles = 5,
  init = 1:0,
  method = "end"
)

new_tab <- data.frame(
  a = 1:10
)

heRomod:::eval_strategy_newdata(
  res1,
  newdata = new_tab
)

PolicyAnalysisInc/heRoMod documentation built on March 23, 2024, 4:29 p.m.