### Application using the implementation of van Aert (2023) with more than two studies.
# Note that these data come from the "metadat" R package that needs to be loaded.
# The data come from the meta-analyses by Lehmann et al. (2018). See the help
# file of dat.lehmann2018 for more information about this meta-analysis.
library(metadat)
dat <- dat.lehmann2018
### Create a new object to indicate which studies were conventional studies and
# which ones were preregistered
dat$conventional <- ifelse(dat$Preregistered == "Not Pre-Registered", 1, 0)
### Lehmann et al. split the analyses for males and females. We only use the data
# of females for this example.
red_romance_femalep <- dat[dat$Gender == "Females", ]
### Prepare data for the analysis
yi <- red_romance_femalep$yi
vi <- red_romance_femalep$vi
conventional <- red_romance_femalep$conventional
### Apply the hybrid method with Wald-type hypothesis tests and confidence intervals
hybrid(yi = yi, vi = vi, conventional = conventional, side = "right")
### Apply the hybrid method with likelihood ratio hypothesis tests and profile
# likelihood confidence intervals
hybrid(yi = yi, vi = vi, conventional = conventional, side = "right",
control = list(type = "profile"))
### Include Color_Match as moderator
Color_Match <- red_romance_femalep$Color_Match
### Apply the hybrid method with Wald-type hypothesis tests and confidence intervals
hybrid(yi = yi, vi = vi, conventional = conventional, side = "right", mods = ~ Color_Match)
### Apply the hybrid method with likelihood ratio hypothesis tests and profile
# likelihood confidence intervals
hybrid(yi = yi, vi = vi, conventional = conventional, side = "right", mods = ~ Color_Match,
control = list(type = "profile"))
### Application using the implementation of van Aert and van Assen (2018).
# The hybrid method is applied to example on page 5 of van Aert and van Assen
# (2018).
pval <- c(0.03, 0.3) # p-value conventional study and replication
n1i <- n2i <- c(40, 80) # Sample sizes per group
tobs <- qt(pval/2, df = n1i+n2i-2, lower.tail = FALSE) # Observed t-values
### Apply hybrid method using the implementation of van Aert and van Assen (2018)
hybrid(tobs = tobs, n1i = n1i, n2i = n2i, side = "right", conventional = c(1,0),
control = list(implementation = "two"))
Run the code above in your browser using DataLab