# NOT RUN {
############################################
# Example on the antidepressants data set. #
# This is from Section 6.2 of the paper by #
# Bai et al. (2020). #
############################################
# Load the full data
data(antidepressants)
attach(antidepressants)
# Extract the 50 published studies
published.data = antidepressants[which(antidepressants$Published==1),]
# Observed treatment effect
y.obs = published.data$Standardized_effect_size
# Observed standard error
s.obs = published.data$Standardized_SE
#################################
# Fit a standard meta-analysis #
# that ignores publication bias #
#################################
# Set seed
set.seed(123)
SMA.mod = StandardMetaAnalysis(y=y.obs, s=s.obs)
# Point estimate for theta
SMA.theta.hat = SMA.mod$theta.hat
# Use Hessian to estimate standard error for theta
SMA.Hessian = SMA.mod$H
# Standard error estimate for theta
SMA.theta.se = sqrt(SMA.Hessian[1,1])
# 95 percent confidence interval
SMA.interval = c(SMA.theta.hat-1.96*SMA.theta.se, SMA.theta.hat+1.96*SMA.theta.se)
# Display results
SMA.theta.hat
SMA.theta.se
SMA.interval
# }
Run the code above in your browser using DataLab