Skip to contents

Computes the quality adjusted life years accrued in a single cycle for each individual. Utilities for states S1 and S2 are adjusted by individual covariate coefficients and by the time spent in the state.

Usage

calc_effsV(
  v_occupied_state,
  v_states_utilities,
  m_indi_features,
  v_util_coeffs,
  v_util_t_decs,
  v_time_in_state,
  cycle_length = 1,
  assert = TRUE
)

Arguments

v_occupied_state

Character vector of current state for each individual.

v_states_utilities

Named numeric vector of base utilities for each state.

m_indi_features

Matrix or data.frame of individual covariates with rows corresponding to individuals and columns corresponding to features. Must include a column named age which is incremented each cycle.

v_util_coeffs

Numeric vector of regression coefficients for utilities.

v_util_t_decs

Named numeric vector of time‑dependent utility decrements for states S1 and S2.

v_time_in_state

Numeric vector indicating the time spent in the current state.

cycle_length

Numeric. Length of each cycle in years. Defaults to 1.

assert

Logical. Boolean for whether to run full assertion of inputs. This feature is useful when running probabilistic sensitivity analysis (PSA).

Value

A numeric vector of QALYs for each individual over the cycle.

Examples

v_occupied_state <- c("H", "S1", "S2", "D")
v_states_utilities <- c(H = 1, S1 = 0.75, S2 = 0.5, D = 0)
m_indi_features <- cbind(age = c(50, 60, 70, 80), sex = c(0, 1, 0, 1))
v_util_coeffs <- c(age = -0.0018, sex = -0.015)
v_util_t_decs <- c(S1 = -0.0015, S2 = -0.002)
v_time_in_state <- c(1, 2, 3, 4)

calc_effsV(
  v_occupied_state = v_occupied_state,
  v_states_utilities = v_states_utilities,
  m_indi_features = m_indi_features,
  v_util_coeffs = v_util_coeffs,
  v_util_t_decs = v_util_t_decs,
  v_time_in_state = v_time_in_state
)
#> [1] 0.910 0.624 0.368 0.000