Description Usage Arguments Value References Examples
View source: R/BayesNonBiasCorrected.R
This function implements the non-bias-corrected Robust Bayesian Copas selection model of Bai et al. (2020) when there is no publication bias (i.e. ρ=0). In this case, the Copas selection model reduces to the standard random effects meta-analysis model:
y_i = θ + τ u_i + s_i ε_i,
where y_i is the reported treatment effect for the ith study, s_i is the reported standard error for the ith study, θ is the population treatment effect of interest, τ > 0 is a heterogeneity parameter, ε_i is distributed as N(0,1), and u_i and ε_i are independent.
For the non-bias-corrected model, we place noninformative priors on (θ, τ^2) (see Bai et al. (2020) for details). For the random effects u_i, i=1, …, n, we give the option for using normal, Student's t, Laplace, or slash distributions for the random effects. If this function is being run in order to quantify publication bias with the robust Bayesian Copas selection model, then the practitioner should use the same random effects distribution that they used for RobustBayesianCopas
.
1 2 3 | BayesNonBiasCorrected(y, s, re.dist=c("normal", "StudentsT", "Laplace", "slash"),
t.df = 4, slash.shape = 1, init=NULL, seed=NULL,
burn=10000, nmc=10000)
|
y |
An n \times 1 vector of reported treatment effects. |
s |
An n \times 1 vector of reported within-study standard errors. |
re.dist |
Distribution for the between-study random effects u_i, i=1, …, n. The user may specify the normal, Student's t, Laplace, or slash distribution. The default is |
t.df |
Degrees of freedom for t-distribution. Only used if |
slash.shape |
Shape parameter in the slash distribution. Only used if |
init |
Optional initialization values for (θ, τ). If specified, they must be provided in this exact order. If they are not provided, the program estimates initial values from the data. |
seed |
Optional seed. This needs to be specified if you want to reproduce the exact results of your analysis. |
burn |
Number of burn-in samples. Default is |
nmc |
Number of posterior samples to save. Default is |
The function returns a list containing the following components:
theta.hat |
posterior mean for θ. |
theta.samples |
MCMC samples for θ after burn-in. Used for plotting the posterior for θ and performing inference of θ. |
tau.hat |
posterior mean for τ. |
tau.samples |
MCMC samples for τ after burn-in. Used for plotting the posterior for τ and performing inference of τ. |
Bai, R., Lin, L., Boland, M. R., and Chen, Y. (2020). "A robust Bayesian Copas selection model for quantifying and correcting publication bias." arXiv preprint arXiv:2005.02930.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ######################################
# Example on the Barlow2014 data set #
######################################
data(Barlow2014)
attach(Barlow2014)
# Observed treatment effect
y.obs = Barlow2014[,1]
# Observed standard error
s.obs = Barlow2014[,2]
####################################
# Fit the non-bias-corrected model #
####################################
# NOTE: Use default burn-in (burn=10000) and post-burn-in samples (nmc=10000)
# Fit the model with Laplace errors.
RBCNoBias.mod = BayesNonBiasCorrected(y=y.obs, s=s.obs, re.dist="Laplace", burn=500, nmc=500)
# Point estimate for theta
theta.hat.RBCNoBias = RBCNoBias.mod$theta.hat
# Standard error for theta
theta.se.RBCNoBias = sd(RBCNoBias.mod$theta.samples)
# 95% posterior credible interval for theta
theta.cred.int = quantile(RBCNoBias.mod$theta.samples, probs=c(0.025,0.975))
# Display results
theta.hat.RBCNoBias
theta.se.RBCNoBias
theta.cred.int
# Plot the posterior for theta
hist(RBCNoBias.mod$theta.samples)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.