### copy data into 'dat' and examine data
dat <- dat.lim2014$o_o_unadj
dat[1:14, -c(2:3)]
if (FALSE) {
### load metafor package
library(metafor)
### load ape package
library(ape, warn.conflicts=FALSE)
### calculate r-to-z transformed correlations and corresponding sampling variances
dat <- escalc(measure="ZCOR", ri=ri, ni=ni, data=dat)
### copy tree to 'tree'
tree <- dat.lim2014$o_o_unadj_tree
### compute branch lengths
tree <- compute.brlen(tree)
### compute phylogenetic correlation matrix
A <- vcv(tree, corr=TRUE)
### make copy of the species variable
dat$species.phy <- dat$species
### create effect size id variable
dat$esid <- 1:nrow(dat)
### fit multilevel phylogenetic meta-analytic model
res <- rma.mv(yi, vi,
random = list(~ 1 | article, ~ 1 | esid, ~ 1 | species, ~ 1 | species.phy),
R=list(species.phy=A), data=dat)
res
}
Run the code above in your browser using DataLab