glm.rmap | R Documentation |
Sample from the posterior distribution of a GLM using the robust meta-analytic predictive prior (RMAP) by Schmidli et al. (2014) doi:10.1111/biom.12242.
glm.rmap(
formula,
family,
data.list,
offset.list = NULL,
w = 0.1,
meta.mean.mean = NULL,
meta.mean.sd = NULL,
meta.sd.mean = NULL,
meta.sd.sd = NULL,
disp.mean = NULL,
disp.sd = NULL,
norm.vague.mean = NULL,
norm.vague.sd = NULL,
bridge.args = NULL,
iter_warmup = 1000,
iter_sampling = 1000,
chains = 4,
...
)
formula |
a two-sided formula giving the relationship between the response variable and covariates. |
family |
an object of class |
data.list |
a list of |
offset.list |
a list of vectors giving the offsets for each data. The length of |
w |
a scalar between 0 and 1 giving how much weight to put on the historical data. Defaults to 0.1. |
meta.mean.mean |
same as |
meta.mean.sd |
same as |
meta.sd.mean |
same as |
meta.sd.sd |
same as |
disp.mean |
a scalar or a vector whose dimension is equal to the number of data sets (including the current
data) giving the location parameters for the half-normal priors on the dispersion parameters. If
a scalar is provided, same as for |
disp.sd |
a scalar or a vector whose dimension is equal to the number of data sets (including the current
data) giving the scale parameters for the half-normal priors on the dispersion parameters. If a
scalar is provided, same as for |
norm.vague.mean |
same as |
norm.vague.sd |
same as |
bridge.args |
a |
iter_warmup |
number of warmup iterations to run per chain. Defaults to 1000. See the argument |
iter_sampling |
number of post-warmup iterations to run per chain. Defaults to 1000. See the argument |
chains |
number of Markov chains to run. Defaults to 4. See the argument |
... |
arguments passed to |
The robust meta-analytic predictive prior (RMAP) is a two-part mixture prior consisting of a meta-analytic predictive (MAP) prior (the prior induced by Bayesian hierarchical model (BHM)) and a vague (i.e., non-informative) prior (specifically, the normal/half-normal prior with large variances). Although Schmidli et al. (2014) recommends to use a finite mixture of conjugate priors to approximate the BHM, it can be difficult and time-consuming to come up with an appropriate approximation.
Instead, the approach taken by hdbayes is to use the marginal likelihood of the MAP and vague priors. Specifically, note that the posterior distribution of a GLM under RMAP is also a two-part mixture distribution. The updated mixture weight for posterior density under the MAP prior is
\widetilde{w} = \frac{w Z_I(D, D_0)}{w Z_I(D, D_0) + (1-w) Z_V(D)},
where w
is the prior mixture weight for the MAP prior in RMAP, Z_I(D, D_0)
is the marginal likelihood
of the MAP prior, and Z_V(D)
is the marginal likelihood of the vague prior.
The function returns a list
with the following objects
an object of class draws_df
giving posterior samples under the robust meta-analytic predictive prior (RMAP)
an object of class draws_df
giving posterior samples under the Bayesian hierarchical model (BHM),
obtained from using glm.bhm()
an object of class draws_df
giving posterior samples under the vague/non-informative prior, obtained
from using glm.post()
output from computing log marginal likelihood of the prior induced by the BHM (referred to as the meta-analytic predictive
(MAP) prior) via glm.logml.map()
function
output from computing log marginal likelihood of the vague prior via glm.logml.post()
function
Schmidli, H., Gsteiger, S., Roychoudhury, S., O’Hagan, A., Spiegelhalter, D., and Neuenschwander, B. (2014). Robust meta‐analytic‐predictive priors in clinical trials with historical control information. Biometrics, 70(4), 1023–1032.
Gronau, Q. F., Singmann, H., and Wagenmakers, E.-J. (2020). bridgesampling: An r package for estimating normalizing constants. Journal of Statistical Software, 92(10).
if (instantiate::stan_cmdstan_exists()) {
data(actg019) ## current data
data(actg036) ## historical data
## take subset for speed purposes
actg019 = actg019[1:150, ]
actg036 = actg036[1:100, ]
data.list = list(actg019, actg036)
glm.rmap(
formula = outcome ~ scale(age) + race + treatment + scale(cd4),
family = binomial('logit'),
data.list = data.list,
w = 0.1,
chains = 1, iter_warmup = 1000, iter_sampling = 2000
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.