Skip to contents

This function calculates the state membership (Markov trace) for different health states based on predicted survival curves.

Usage

calculate_markov_trace(df_survival_curves_long, l_params)

Arguments

df_survival_curves_long

A data frame containing the predicted cumulative survival curves in long format with columns for time, treatment, end_point, and survival probabilities.

l_params

A list of model parameters including the list of parameters in the list l_psm_parameters in addition to:

  • time_horizon: The time horizon for the model in years.

  • cycle_length: The length of a model cycle measured in years.

  • disc_rate_costs: The annual discount rate for incurred costs.

  • disc_rate_qalys: The annual discount rate for accrued QALYs.

Value

A data frame in wide format with columns for time, treatment, and states occupancy (`EFS`, `PPS`, `D`).

Examples

if (FALSE) { # \dontrun{
# Load the fitted Gompertz model parameters
models_fit <- NeuroblastomaPSM::parametric_models

# Define model parameters
params <- c(
  time_horizon = 10,
  cycle_length = 1/12,
  disc_rate_costs = 0.035,
  disc_rate_qalys = 0.015,
  NeuroblastomaPSM::l_psm_parameters
)

# Predict cumulative survival
df_survival_curves_long <- NeuroblastomaPSM::predict_cumulative_survival(
  models_fit = models_fit,
  l_params = params
)

# Generate Markov trace
df_markov_trace <- NeuroblastomaPSM::calculate_markov_trace(
  df_survival_curves_long = df_survival_curves_long,
  l_params = params
)

rbind(
  head(df_markov_trace, n = 5),
  tail(df_markov_trace, n = 5)
)

# Define model parameters - longer time horizons triggers cure_threshold
params2 <- c(
  time_horizon = 25,
  cycle_length = 1/12,
  disc_rate_costs = 0.035,
  disc_rate_qalys = 0.015,
  NeuroblastomaPSM::l_psm_parameters
)

# Predict cumulative survival
df_survival_curves_long2 <- NeuroblastomaPSM::predict_cumulative_survival(
  models_fit = models_fit,
  l_params = params2
)

# Generate Markov trace
df_markov_trace2 <- NeuroblastomaPSM::calculate_markov_trace(
  df_survival_curves_long = df_survival_curves_long2,
  l_params = params2
)

rbind(
  head(df_markov_trace2, n = 5),
  tail(df_markov_trace2, n = 5)
)
} # }