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.

  dist = c("norm", "beta", "gamma", "lnorm", "unif", "fixed", "custom"),
  hesim_data = NULL,
  grp_var = NULL



A data.frame or data.table for storing parameter values. See "Details" for specifics.


Probability distribution used to sample parameters for a probabilistic sensitivity analysis (PSA).


A hesim_data object. This argument is deprecated and should be passed to create_StateVals.stateval_tbl() instead.


The name of the variable used to group patients.


An object of class stateval_tbl, which is a data.table of parameter values with attributes for dist and grp_var.


tbl is a tabular object containing columns for treatment strategies (strategy_id), patients (patient_id), health states (state_id), and/or the start of time intervals (time_start). The table must contain at least one column named strategy_id, patient_id, or state_id, 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 grp_var (rather than 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 dist. Available distributions include the normal (norm), beta (beta), gamma (gamma), lognormal (lnorm), and uniform (unif) 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:


mean and sd


mean and se or shape1 and shape2


mean and se, shape and rate, or shape and scale


meanlog or sdlog


min and max




sample and value

Note that if dist = "custom", then tbl must include a column named 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 (sample) and each combination of strategies, patients, health states, and/or time intervals. Again, tbl must contain at least one column named strategy_id, patient_id (or grp_var), or state_id, 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",
                            grp_var = "grp")
#>      grp state_id  mean    se
#>    <num>    <num> <num> <num>
#> 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.06
utilmod <- create_StateVals(utility_tbl, n = 2, hesim_data = hesim_dat)

# 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")
#>    strategy_id  mean    se
#>          <num> <num> <num>
#> 1:           1  5000   200
#> 2:           2  3000   100
costmod <- create_StateVals(cost_tbl, n = 2, hesim_data = hesim_dat)