Computes the cost incurred by each individual in a cycle based on their current health state and individual covariates. Costs for states S1 and S2 can be modified by regression coefficients applied to the individual features (e.g. age, sex).
Arguments
- v_occupied_state
Character vector of current state for each individual.
- v_states_costs
Named numeric vector of base costs 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
agewhich is incremented each cycle.- v_cost_coeffs
Numeric vector of regression coefficients for costs.
Examples
v_occupied_state <- c("H", "S1", "S2", "D")
v_states_costs <- c(H = 2000, S1 = 4000, S2 = 15000, D = 0)
m_indi_features <- cbind(age = c(50, 60, 70, 80), sex = c(0, 1, 0, 1))
v_cost_coeffs <- c(age = 11.5, sex = 300)
calc_costsV(
v_occupied_state = v_occupied_state,
v_states_costs = v_states_costs,
m_indi_features = m_indi_features,
v_cost_coeffs = v_cost_coeffs
)
#> [1] 2000 4990 15805 0