Create a list containing means predicted from a statistical model.

tparams_mean(value, ...)

Arguments

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.

Value

An object of class tparams_mean, which is a list containing value, n_samples, and the ID attributes passed to id_attributes.

Note

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().

See also

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().

Examples

# 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 4791.507 160.14456 4683.930 4899.085
#>  2:           1          1        2 4791.507 160.14456 4683.930 4899.085
#>  3:           1          1        3 4791.507 160.14456 4683.930 4899.085
#>  4:           1          2        1 4791.507 160.14456 4683.930 4899.085
#>  5:           1          2        2 4791.507 160.14456 4683.930 4899.085
#>  6:           1          2        3 4791.507 160.14456 4683.930 4899.085
#>  7:           2          1        1 2924.774  20.72482 2910.852 2938.696
#>  8:           2          1        2 2924.774  20.72482 2910.852 2938.696
#>  9:           2          1        3 2924.774  20.72482 2910.852 2938.696
#> 10:           2          2        1 2924.774  20.72482 2910.852 2938.696
#> 11:           2          2        2 2924.774  20.72482 2910.852 2938.696
#> 12:           2          2        3 2924.774  20.72482 2910.852 2938.696
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 4791.507 160.14456 4683.930 4899.085
#>  2:           1          1        2 4791.507 160.14456 4683.930 4899.085
#>  3:           1          1        3 4791.507 160.14456 4683.930 4899.085
#>  4:           1          2        1 4791.507 160.14456 4683.930 4899.085
#>  5:           1          2        2 4791.507 160.14456 4683.930 4899.085
#>  6:           1          2        3 4791.507 160.14456 4683.930 4899.085
#>  7:           2          1        1 2924.774  20.72482 2910.852 2938.696
#>  8:           2          1        2 2924.774  20.72482 2910.852 2938.696
#>  9:           2          1        3 2924.774  20.72482 2910.852 2938.696
#> 10:           2          2        1 2924.774  20.72482 2910.852 2938.696
#> 11:           2          2        2 2924.774  20.72482 2910.852 2938.696
#> 12:           2          2        3 2924.774  20.72482 2910.852 2938.696