# NOT RUN {
### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
### random-effects model
res1 <- rma(yi, vi, data=dat, method="ML")
### mixed-effects model with two moderators (absolute latitude and publication year)
res2 <- rma(yi, vi, mods = ~ ablat + year, data=dat, method="ML")
### Wald-type test of the two moderators
anova(res2)
### alternative way of specifying the same test
anova(res2, L=rbind(c(0,1,0), c(0,0,1)))
### corresponding likelihood ratio test
anova(res1, res2)
### test of a linear combination
anova(res2, L=c(1,35,1970))
### mixed-effects model with three moderators
res3 <- rma(yi, vi, mods = ~ ablat + year + alloc, data=dat, method="ML")
res3
### test the 'alloc' factor
anova(res3, btt=4:5)
### instead of specifying the coefficient numbers, grep for "alloc"
anova(res3, btt="alloc")
# }
Run the code above in your browser using DataLab