<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/effect-size-calculation-for-meta-analysis-in-r-rstats/"></div></div><div><a data-url="https://www.r-bloggers.com/effect-size-calculation-for-meta-analysis-in-r-rstats/" data-counturl="https://www.r-bloggers.com/effect-size-calculation-for-meta-analysis-in-r-rstats/" data-count="horizontal" data-text="Effect-Size Calculation for Meta-Analysis in R #rstats" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://strengejacke.wordpress.com/2016/09/08/effect-size-calculation-for-meta-analysis-in-r-rstats/"> R – Strenge Jacke!</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>When conducting meta-analysis, you most likely have to calculate or convert effects sizes into an effect size with common measure. There are various tools to do this – one easy to use tool is the <a target="_blank" href="http://www.campbellcollaboration.org/escalc/html/EffectSizeCalculator-Home.php">Practical Meta-Analysis Effect Size Calculator</a> from David B. Wilson.</p>
<p>This online-tool is now implemented as an R-package: <a target="_blank" href="https://cran.r-project.org/package=esc">esc: Effect Size Computation for Meta Analysis</a>.</p>
<p><strong>Calculating Effect Sizes</strong></p>
<p>The package covers most of the effect size calculation and conversion options from the online-tool, but in a more compact way, which gives you a better overiew. For instance, getting an effect size from a t-test, means you have to find and choose from four different options <a target="_blank" href="http://www.campbellcollaboration.org/escalc/html/EffectSizeCalculator-SMD2.php">in the online tool</a>, while the <em>esc</em>-package just needs one function: </p>
<pre>esc_t(t, p, totaln, grp1n, grp2n, 
      es.type = c(&quot;d&quot;, &quot;g&quot;, &quot;or&quot;, &quot;logit&quot;, &quot;r&quot;, &quot;cox.or&quot;, &quot;cox.log&quot;), 
      study = NULL, ...)</pre>
<p>You can then compute the effect size, depending on your available parameters, like this:</p>
<pre># unequal sample size
esc_t(t = 3.3, grp1n = 100, grp2n = 150)

# equal sample size
esc_t(t = 3.3, totaln = 200)

# unequal sample size, with p-value
esc_t(p = 0.03, grp1n = 100, grp2n = 150)

# equal sample size, with p-value
esc_t(p = 0.03, totaln = 200)</pre>
<p><strong>Converting Effect Sizes</strong></p>
<p>The package offers various functions to convert one effect size into another: <code>esc_d2logit()</code> (std. mean diff. to log-odds), <code>esc_d2or()</code> (std. mean diff. to odds ratios), <code>esc_d2r()</code> (std. mean diff. to correlation r), <code>esc_or2d()</code> (odds ratio to std. mean diff.), <code>esc_r2z()</code> (correlation coefficient r into Fisher’s z) and <code>esc_z2r()</code> (Fisher’s z into correlation coefficient r). However, the <code>es.type</code>-argument in each function gives you the required effect size measure directly.</p>
<p><strong>Workflow with the metafor-package</strong></p>
<p>The results of the effect size calculation functions in this package are returned as list with a <code>esc</code>-class attribute. The <code>combine_esc()</code>-function takes one or more of these esc-objects and combines them into a <code>data.frame</code> that can be used as argument for further use, for instance with the <code>rma()</code>-function.</p>
<pre>e1 &lt;- esc_2x2(grp1yes = 30, grp1no = 50, grp2yes = 40,
              grp2no = 45, study = &quot;Study 1&quot;)
e2 &lt;- esc_2x2(grp1yes = 30, grp1no = 50, grp2yes = 40, grp2no = 45,
              es.type = &quot;or&quot;, study = &quot;Study 2&quot;)
e3 &lt;- esc_t(p = 0.03, grp1n = 100, grp2n = 150, study = &quot;Study 3&quot;)
e4 &lt;- esc_mean_sd(grp1m = 7, grp1sd = 2, grp1n = 50, grp2m = 9, grp2sd = 3,
                  grp2n = 60, es.type = &quot;logit&quot;, study = &quot;Study 4&quot;)

mydat &lt;- combine_esc(e1, e2, e3, e4)</pre>
<p>Now, <em>mydat</em> contains a data frame with the results of several effect size calculations:</p>
<pre>> mydat
    study         es    weight sample.size        se        var       ci.lo      ci.hi measure
1 Study 1 -0.3930426  9.944751         165 0.3171050 0.10055556 -1.01455689  0.2284717   logit
2 Study 2  0.6750000  9.944751         165 0.3171050 0.10055556  0.36256305  1.2566780      or
3 Study 3  0.2817789 59.433720         250 0.1297130 0.01682547  0.02754605  0.5360117       d
4 Study 4 -1.3981827  7.721145         110 0.3598812 0.12951447 -2.10353685 -0.6928285   logit</pre>
<p>The meta-analysis is then computed like this (note that the different effect-size measures are just for demonstration purposes – usually, you should have only one common effect size that goes into the meta-analysis):</p>
<pre>metafor::rma(yi = es, sei = se, method = &quot;REML&quot;, data = mydat)</pre>
<p><strong>Last words</strong></p>
<p>The package update 0.2.0 includes a small convenient function, <code>write_esc()</code>, to write an Excel-csv-file with the converted effect sizes.</p>
<p> Tagged: <a target="_blank" href="https://strengejacke.wordpress.com/tag/effect-size/">effect-size</a>, <a target="_blank" href="https://strengejacke.wordpress.com/tag/meta-analysis/">meta-analysis</a>, <a target="_blank" href="https://strengejacke.wordpress.com/tag/r/">R</a>, <a target="_blank" href="https://strengejacke.wordpress.com/tag/rstats/">rstats</a> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/strengejacke.wordpress.com/1132/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/strengejacke.wordpress.com/1132/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/effect-size-calculation-for-meta-analysis-in-r-rstats/"></div></div><div><a data-url="https://www.r-bloggers.com/effect-size-calculation-for-meta-analysis-in-r-rstats/" data-counturl="https://www.r-bloggers.com/effect-size-calculation-for-meta-analysis-in-r-rstats/" data-count="vertical" data-text="Effect-Size Calculation for Meta-Analysis in R #rstats" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://strengejacke.wordpress.com/2016/09/08/effect-size-calculation-for-meta-analysis-in-r-rstats/"> R – Strenge Jacke!</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/4cj_OYsKmRM"></a></div>