Create a list containing means predicted from a statistical model.
tparams_mean(value, ...)
Matrix of samples from the distribution of the mean. Columns denote random samples and rows denote means for different observations.
Arguments to pass to id_attributes. Each row in
value
must be a prediction for a strategy_id
,
patient_id
, state_id
, and optionally time_id
combination.
An object of class tparams_mean
, which is a list containing value
,
n_samples
, and the ID attributes passed to id_attributes.
The tparams_mean()
constructor would not normally be used by users; instead,
a tparams_mean
object is typically created automatically as part of the
StateVals
class with create_StateVals()
.
A tparams_mean
object is a type of transformed parameter
object and is a supported class type of the params
field of the StateVals
class. See the documentation for create_StateVals()
and stateval_tbl()
for examples of how to createStateVals
objects. Predicted means can be
summarized across parameter samples using summary.tparams_mean()
.
# Setup model
hesim_dat <- hesim_data(
strategies = data.frame(strategy_id = c(1, 2)),
patients = data.frame(patient_id = c(1, 2)),
states = data.frame(
state_id = c(1, 2, 3),
state_name = c("state1", "state2", "state3")
)
)
# Cost model
cost_tbl <- stateval_tbl(
data.frame(strategy_id = hesim_dat$strategies$strategy_id,
mean = c(5000, 3000),
se = c(200, 100)
),
dist = "gamma"
)
costmod <- create_StateVals(cost_tbl, n = 2, hesim_data = hesim_dat)
# The 'params' field of the `StateVals` class is a tparams_mean object
class(costmod$params)
#> [1] "tparams_mean"
costmod$params
#> A "tparams_mean" object
#>
#> Summary of means:
#> strategy_id patient_id state_id mean sd 2.5% 97.5%
#> <num> <num> <num> <num> <num> <num> <num>
#> 1: 1 1 1 4913.711 301.17196 4711.399 5116.024
#> 2: 1 1 2 4913.711 301.17196 4711.399 5116.024
#> 3: 1 1 3 4913.711 301.17196 4711.399 5116.024
#> 4: 1 2 1 4913.711 301.17196 4711.399 5116.024
#> 5: 1 2 2 4913.711 301.17196 4711.399 5116.024
#> 6: 1 2 3 4913.711 301.17196 4711.399 5116.024
#> 7: 2 1 1 3064.802 13.20316 3055.933 3073.672
#> 8: 2 1 2 3064.802 13.20316 3055.933 3073.672
#> 9: 2 1 3 3064.802 13.20316 3055.933 3073.672
#> 10: 2 2 1 3064.802 13.20316 3055.933 3073.672
#> 11: 2 2 2 3064.802 13.20316 3055.933 3073.672
#> 12: 2 2 3 3064.802 13.20316 3055.933 3073.672
summary(costmod$params)
#> strategy_id patient_id state_id mean sd 2.5% 97.5%
#> <num> <num> <num> <num> <num> <num> <num>
#> 1: 1 1 1 4913.711 301.17196 4711.399 5116.024
#> 2: 1 1 2 4913.711 301.17196 4711.399 5116.024
#> 3: 1 1 3 4913.711 301.17196 4711.399 5116.024
#> 4: 1 2 1 4913.711 301.17196 4711.399 5116.024
#> 5: 1 2 2 4913.711 301.17196 4711.399 5116.024
#> 6: 1 2 3 4913.711 301.17196 4711.399 5116.024
#> 7: 2 1 1 3064.802 13.20316 3055.933 3073.672
#> 8: 2 1 2 3064.802 13.20316 3055.933 3073.672
#> 9: 2 1 3 3064.802 13.20316 3055.933 3073.672
#> 10: 2 2 1 3064.802 13.20316 3055.933 3073.672
#> 11: 2 2 2 3064.802 13.20316 3055.933 3073.672
#> 12: 2 2 3 3064.802 13.20316 3055.933 3073.672