markov_model: Definition of Markov model and trace

Description Usage Arguments Details Value Examples

View source: R/1_model_functions.R

Description

Definition of Markov model and trace

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
markov_model(
  current_strategy,
  cycles,
  initial_state,
  discount = c(0, 0),
  parameter_values = NULL,
  half_cycle_correction = TRUE,
  state_cost_only_prevalent = FALSE,
  state_util_only_prevalent = FALSE,
  method = "half cycle correction",
  startup_cost = NULL,
  startup_util = NULL
)

Arguments

current_strategy

strategy object

cycles

no of cycles

initial_state

value of states initially

discount

rate of discount for costs and qalys

parameter_values

parameters for assigning health states and probabilities

half_cycle_correction

boolean to indicate half cycle correction

state_cost_only_prevalent

boolean parameter to indicate if the costs for state occupancy is only for those in the state excluding those that transitioned new. This is relevant when the transition cost is provided for eg. in a state with dialysis the cost of previous dialysis is different from the newly dialysis cases. Then the state_cost_only_prevalent should be TRUE

state_util_only_prevalent

boolean parameter to indicate if the utilities for state occupancy is only for those in the state excluding those that transitioned new.

method

what type of half cycle correction needed

startup_cost

cost of states initially

startup_util

utility of states initially if any

Details

Use the strategy, cycles, initial state values creating the markov model and trace. As many probabilities /cost/utility value depend on age/time the evaluation and assignment happens during each cycle. At the heart it does a matrix multiplication using the previous row of the trace matrix and the columns of the transition matrix. Also checks for population loss, calculates cumulative costs and qalys (accounts for discounting and half cycle correction)

Value

Markov trace

Examples

1
2
3
4
5
6
7
8
tmat <- rbind(c(1, 2), c(3, 4))
colnames(tmat) <- rownames(tmat) <- c("Healthy", "Dead")
tm <- populate_transition_matrix(2, tmat, c(0.5, 0.5, 0, 1))
a <- health_state("Healthy", 1, 1, 0, FALSE)
b <- health_state("Dead", 1, 0, 0, TRUE)
health_states <- combine_state(a, b)
this.strategy <- strategy(tm, health_states, "intervention")
markov_model(this.strategy, 10, c(1, 0))

packDAMipd documentation built on March 3, 2021, 5:07 p.m.