hbl_ess | R Documentation |
Quantify borrowing with effective sample size (ESS) as cited and explained in the methods vignette at https://wlandau.github.io/historicalborrowlong/articles/methods.html.
hbl_ess(
mcmc_pool,
mcmc_hierarchical,
data,
response = "response",
study = "study",
study_reference = max(data[[study]]),
group = "group",
group_reference = min(data[[group]]),
patient = "patient",
rep = "rep",
rep_reference = min(data[[rep]])
)
mcmc_pool |
A fitted model from |
mcmc_hierarchical |
A fitted model from |
data |
A tidy data frame or |
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 |
rep |
Character of length 1,
name of the column in |
rep_reference |
Atomic of length 1,
element of the |
A data frame with one row per discrete time point ("rep") and the following columns:
v0
: posterior predictive variance of the control group mean of a
hypothetical new study given the pooled model.
Calculated as the mean over MCMC samples of 1 / sum(sigma_i ^ 2)
,
where each sigma_i
is the residual standard deviation of
study i
estimated from the pooled model.
v_tau
: posterior predictive variance of a hypothetical
new control group mean under the hierarchical model.
Calculated by averaging over predictive draws,
where each predictive draw is from
rnorm(n = 1, mean = mu_, sd = tau_)
and mu_
and tau_
are the
mu
and tau
components of an MCMC sample.
n
: number of non-missing historical control patients.
weight
: strength of borrowing as a ratio of variances: v0 / v_tau
.
ess
: strength of borrowing as a prior effective sample size:
n v0 / v_tau
, where n
is the number of non-missing historical
control patients.
Other summary:
hbl_summary()
set.seed(0)
data <- hbl_sim_independent(n_continuous = 2)$data
data$group <- sprintf("group%s", data$group)
data$study <- sprintf("study%s", data$study)
data$rep <- sprintf("rep%s", data$rep)
tmp <- utils::capture.output(
suppressWarnings(
pool <- hbl_mcmc_pool(
data,
chains = 1,
warmup = 10,
iter = 20,
seed = 0
)
)
)
tmp <- utils::capture.output(
suppressWarnings(
hierarchical <- hbl_mcmc_hierarchical(
data,
chains = 1,
warmup = 10,
iter = 20,
seed = 0
)
)
)
hbl_ess(
mcmc_pool = pool,
mcmc_hierarchical = hierarchical,
data = data
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.