The metafor Package

A Meta-Analysis Package for R

User Tools

Site Tools


analyses:gleser2009

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
analyses:gleser2009 [2022/08/03 11:17] Wolfgang Viechtbaueranalyses:gleser2009 [2022/08/03 16:58] (current) Wolfgang Viechtbauer
Line 336: Line 336:
 dat$yi <- round(with(dat, (m2i-m1i)/sdpi), 3) dat$yi <- round(with(dat, (m2i-m1i)/sdpi), 3)
 dat$vi <- round(with(dat, 1/n1i + 1/n2i + yi^2/(2*(n1i+n2i))), 4) dat$vi <- round(with(dat, 1/n1i + 1/n2i + yi^2/(2*(n1i+n2i))), 4)
-dat$covi <- round(with(dat, (1/n1i + 1/n2i) * ri + (rep(sapply(split(dat$yi, dat$school), prod), each=2) / (2*(n1i+n2i))) * ri^2), 4)+dat$covi <- round(with(dat, (1/n1i + 1/n2i) * ri +  
 +                            (rep(sapply(split(dat$yi, dat$school), prod), each=2) /  
 +                            (2*(n1i+n2i))) * ri^2), 4)
 </code> </code>
 The contents of the resulting dataset are: The contents of the resulting dataset are:
Line 359: Line 361:
 The variance-covariance matrix for the entire dataset can be constructed with: The variance-covariance matrix for the entire dataset can be constructed with:
 <code rsplus> <code rsplus>
-V <- bldiag(lapply(split(dat, dat$school), function(x) matrix(c(x$vi[1], x$covi[1], x$covi[2], x$vi[2]), nrow=2)))+V <- bldiag(lapply(split(dat, dat$school),  
 +            function(x) matrix(c(x$vi[1], x$covi[1], x$covi[2], x$vi[2]), nrow=2)))
 V V
 </code> </code>
analyses/gleser2009.txt · Last modified: 2022/08/03 16:58 by Wolfgang Viechtbauer