hb_summary {historicalborrow} | R Documentation |
Model summary
Description
Summarize a fitted model in a table.
Usage
hb_summary(
mcmc,
data,
response = "response",
study = "study",
study_reference = max(data[[study]]),
group = "group",
group_reference = min(data[[group]]),
patient = "patient",
covariates = grep("^covariate", colnames(data), value = TRUE),
eoi = 0,
direction = "<"
)
Arguments
mcmc |
A wide data frame of posterior samples returned by
|
data |
Tidy data frame with one row per patient,
indicator columns for the response variable,
study, group, and patient,
and covariates. All columns must be atomic vectors
(e.g. not lists). The data for the mixture and simple models
should have just one study,
and the others should have
data from more than one study. The simple model can be used
to get the historical data components of |
response |
Character of length 1,
name of the column in |
study |
Character of length 1,
name of the column in |
study_reference |
Atomic of length 1,
element of the |
group |
Character of length 1,
name of the column in |
group_reference |
Atomic of length 1,
element of the |
patient |
Character of length 1,
name of the column in |
covariates |
Character vector of column names
in |
eoi |
Numeric of length at least 1, vector of effects of interest (EOIs) for critical success factors (CSFs). |
direction |
Character of length |
Details
The hb_summary()
function post-processes the results from
the model. It accepts MCMC samples of parameters and returns
interpretable group-level posterior summaries such as change
from baseline response and treatment effect. To arrive at these
summaries, hb_summary()
computes marginal posteriors of
transformed parameters. The transformations derive patient-level
fitted values from model parameters, then derive group-level
responses as averages of fitted values. We refer to this style
of estimation as "unconditional estimation", as opposed to
"conditional estimation", which takes each group mean to be the
appropriate linear combination of the relevant alpha
and delta
parameters, without using beta
components or going through fitted
values. If the baseline covariates are balanced across studies,
unconditional and conditional estimation should produce similar
estimates of placebo and treatment effects.
Value
A tidy data frame with one row per group (e.g. treatment arm)
and the columns in the following list. Unless otherwise specified,
the quantities are calculated at the group level.
Some are calculated for the current (non-historical) study only,
while others pertain to the combined dataset which includes
all historical studies.
The mixture model is an exception because the data
argument
only includes the current study, so other quantities that include
historical information will need to borrow from an hb_summary()
call on one of the other models.
-
group
: group label. -
data_mean
: observed mean response specific to the current study. -
data_sd
: observed standard deviation of the response specific to the current study. -
data_lower
: lower bound of a simple frequentist 95% confidence interval of the observed mean specific to the current study. -
data_upper
: upper bound of a simple frequentist 95% confidence interval of the observed mean specific to the current study. -
data_n
: number of non-missing observations in the combined dataset with all studies. -
data_N
: total number of observations (missing and non-missing) in the combined dataset with all studies. -
data_n_study_*
: number of non-missing observations separately for each study. The suffixes of these column names are integer study indexes. Calldplyr::distinct(hb_data(your_data), study, study_label)
to see which study labels correspond to these integer indexes. Note: the combined dataset for the mixture model is just the current study. If all thedata_n_study_*
results across all studies are desired, then callhb_summary()
on a different model (e.g. pooled). -
data_N_study_*
: same asdata_n_study_*
except both missing and non-missing observations are counted (total number of observations). -
response_mean
: Estimated posterior mean of the response from the model specific to the current study. Typically, the raw response is change from baseline, in which caseresponse_mean
is estimating change from baseline. -
response_sd
: Estimated posterior standard deviation of the mean response from the model specific to the current study. -
response_variance
: Estimated posterior variance of the mean response from the model specific to the current study. -
response_lower
: Lower bound of a 95% posterior interval on the mean response from the model specific to the current study. -
response_upper
: Upper bound of a 95% posterior interval on the mean response from the model specific to the current study. -
response_mean_mcse
: Monte Carlo standard error ofresponse_mean
. -
response_sd_mcse
: Monte Carlo standard error ofresponse_sd
. -
response_lower_mcse
: Monte Carlo standard error ofresponse_lower
. -
response_upper_mcse
: Monte Carlo standard error ofresponse_upper
. -
diff_mean
: Estimated treatment effect from the model specific to the current study. -
diff_lower
: Lower bound of a 95% posterior interval on the treatment effect from the model specific to the current study.. -
diff_upper
: Upper bound of a 95% posterior interval on the treatment effect from the model specific to the current study.. -
diff_mean_mcse
: Monte Carlo standard error ofdiff_mean
. -
diff_lower_mcse
: Monte Carlo standard error ofdiff_lower
. -
diff_upper_mcse
: Monte Carlo standard error ofdiff_upper
. -
P(diff > EOI)
,P(diff < EOI)
: CSF probabilities on the treatment effect specified with theeoi
anddirection
arguments. Specific to the current study. -
effect_mean
: Estimated posterior mean of effect size (treatment difference divided by residual standard deviation). Specific to the current study. -
effect_lower
: Lower bound of a 95% posterior interval of effect size from the model. Specific to the current study. -
effect_upper
: Upper bound of a 95% posterior interval of effect size from the model. Specific to the current study. -
precision_ratio
: For the hierarchical model only, a model-based mean of the precision ratio. Specific to the current study. -
precision_ratio_lower
: For the hierarchical model only, lower bound of a model-based 95% posterior interval of the precision ratio. Specific to the current study. -
precision_ratio_upper
: For the hierarchical model only, upper bound of a model-based 95% posterior interval of the precision ratio. Specific to the current study. -
mix_prop_*
: For the mixture model only, posterior mixture proportions of each of the mixture components. The last one is for the current study and the first ones are for the historical studies. The suffixes of these column names are the integer study indexes. Calldplyr::distinct(hb_data(your_data), study, study_label)
to see which study labels correspond to these integer indexes.
See Also
Other summary:
hb_metrics()
Examples
if (!identical(Sys.getenv("HB_TEST", unset = ""), "")) {
data <- hb_sim_pool(n_continuous = 2)$data
data$group <- sprintf("group%s", data$group)
mcmc <- hb_mcmc_pool(
data,
n_chains = 1,
n_adapt = 100,
n_warmup = 50,
n_iterations = 50
)
hb_summary(mcmc, data)
}