### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg,
data=dat.bcg, slab=paste0(author, ", ", year))
### fit random-effects model
res <- rma(yi, vi, data=dat, digits=3)
### cumulative meta-analysis (in the order of publication year)
cumul(res, order=year)
cumul(res, order=year, transf=exp)
### add studies with the same publication year simultaneously
cumul(res, order=year, transf=exp, collapse=TRUE)
### meta-analysis of the (log) risk ratios using the Mantel-Haenszel method
res <- rma.mh(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg,
data=dat.bcg, slab=paste0(author, ", ", year), digits=3)
### cumulative meta-analysis
cumul(res, order=year)
cumul(res, order=year, transf=exp)
### add studies with the same publication year simultaneously
cumul(res, order=year, transf=exp, collapse=TRUE)
### meta-analysis of the (log) odds ratios using Peto's method
res <- rma.peto(ai=tpos, bi=tneg, ci=cpos, di=cneg,
data=dat.bcg, slab=paste0(author, ", ", year), digits=3)
### cumulative meta-analysis
cumul(res, order=year)
cumul(res, order=year, transf=exp)
### add studies with the same publication year simultaneously
cumul(res, order=year, transf=exp, collapse=TRUE)
### make the first log risk ratio missing and fit the model without study 2;
### then the variable specified via 'order' should still be of the same length
### as the original dataset; subsetting and removal of studies with missing
### values is automatically done by the cumul() function
dat$yi[1] <- NA
res <- rma(yi, vi, data=dat, subset=-2, digits=3)
cumul(res, transf=exp, order=year)
Run the code above in your browser using DataLab