Create a table for storing parameter estimates used to simulate costs or utility in an economic model by treatment strategy, patient, health state, and (optionally) time interval.
stateval_tbl( tbl, dist = c("norm", "beta", "gamma", "lnorm", "unif", "fixed", "custom"), hesim_data = NULL, grp_var = NULL )
Probability distribution used to sample parameters for a probabilistic sensitivity analysis (PSA).
A hesim_data object. Required to specify
treatment strategies , patients,
and/or health states not included as columns
The name of the variable used to group patients.
An object of class "stateval_tbl", which is a
parameter values with attributes for
dist and optionally
is in the same format as described in "Details".
patients is a
data.table with one column containing
optionally a second column containing
tbl is a
data.table containing columns for treatment
strategy_id), patients (
health states (
state_id), and/or the start of time intervals
time_start). The table must contain at least one column
but does not need to contain all of them. Each row denotes a unique
treatment strategy, patient, health state, and/or time interval pair.
tbl may also contain a column with the name specified in
patient_id) so that state values are assigned to
groups of patients.
tbl must also contain columns summarizing the state values for each
row, which depend on the probability distribution selected with
Available distributions include the normal (
norm), beta (
gamma), lognormal (
lnorm), and uniform (
distributions. In addition, the option
fixed can be used if estimates
are known with certainty and
custom can be used if
parameter values for a PSA have been previously
sampled from an arbitrary probability distribution.
The columns in
tbl that must be included,
by distribution, are:
Note that if
dist = "custom", then
tbl must include a column
sample (an integer vector denoting a unique random draw) and
value (denoting the value of the randomly sampled parameter). In this case,
there is a unique row in
tbl for each random draw (
each combination of strategies, patients, health states, and/or time intervals.
tbl must contain at least one column
but does not need to contain them all.
strategies <- data.frame(strategy_id = c(1, 2)) patients <- data.frame(patient_id = seq(1, 3), grp = c(1, 1, 2), age = c(45, 50, 60), female = c(0, 0, 1)) states <- data.frame(state_id = c(1, 2)) hesim_dat <- hesim_data(strategies = strategies, patients = patients, states = states) # Utility varies by health state and patient group utility_tbl <- stateval_tbl(data.frame(state_id = rep(states$state_id, 2), grp = rep(rep(c(1, 2)), each = nrow(states)), mean = c(.8, .7, .75, .55), se = c(.18, .12, .10, .06)), dist = "beta", hesim_data = hesim_dat, grp_var = "grp") print(utility_tbl)#> grp state_id mean se #> 1: 1 1 0.80 0.18 #> 2: 1 2 0.70 0.12 #> 3: 2 1 0.75 0.10 #> 4: 2 2 0.55 0.06utilmod <- create_StateVals(utility_tbl, n = 2) # Costs vary by treatment strategy cost_tbl <- stateval_tbl(data.frame(strategy_id = strategies$strategy_id, mean = c(5000, 3000), se = c(200, 100)), dist = "gamma", hesim_data = hesim_dat) print(cost_tbl)#> strategy_id mean se #> 1: 1 5000 200 #> 2: 2 3000 100costmod <- create_StateVals(cost_tbl, n = 2)