The metafor Package

A Meta-Analysis Package for R

User Tools

Site Tools


faq

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
faq [2022/08/30 11:18] Wolfgang Viechtbauerfaq [2023/01/24 07:56] (current) – [General Questions] Wolfgang Viechtbauer
Line 53: Line 53:
 !!! There are actually many R packages available for conducting meta-analyses. To get an appreciation for what the "meta-analysis package ecosystem" currently looks like, take a look at the [[http://cran.r-project.org/web/views/MetaAnalysis.html|Task View for Meta-Analysis]], which provides a pretty thorough overview of the different packages and their capabilities. !!! There are actually many R packages available for conducting meta-analyses. To get an appreciation for what the "meta-analysis package ecosystem" currently looks like, take a look at the [[http://cran.r-project.org/web/views/MetaAnalysis.html|Task View for Meta-Analysis]], which provides a pretty thorough overview of the different packages and their capabilities.
  
-??? Why can I not just use the lm() and lme(), and lmer() functions to conduct my meta-analysis?+??? Why can I not just use the lm()lme(), and lmer() functions to conduct my meta-analysis?
  
 !!! First of all, meta-analytic models (as can be fitted with the ''[[https://wviechtb.github.io/metafor/reference/rma.uni.html|rma.uni()]]'' and ''[[https://wviechtb.github.io/metafor/reference/rma.mv.html|rma.mv()]]'' functions) make different assumptions about the nature of the sampling variances (that indicate the (im)precision of the estimates) compared to models fitted by the ''lm()'', ''lme()'', and ''lmer()'' functions, which assume that the sampling variances are known only up to a proportionality constant (when using their ''weights'' arguments). Extra steps must therefore be taken to fix up the output to bring the results in line with standard meta-analytic practices. For more details, I have written up a more comprehensive [[tips:rma_vs_lm_lme_lmer|comparison of the rma() and the lm(), lme(), and lmer() functions]]. !!! First of all, meta-analytic models (as can be fitted with the ''[[https://wviechtb.github.io/metafor/reference/rma.uni.html|rma.uni()]]'' and ''[[https://wviechtb.github.io/metafor/reference/rma.mv.html|rma.mv()]]'' functions) make different assumptions about the nature of the sampling variances (that indicate the (im)precision of the estimates) compared to models fitted by the ''lm()'', ''lme()'', and ''lmer()'' functions, which assume that the sampling variances are known only up to a proportionality constant (when using their ''weights'' arguments). Extra steps must therefore be taken to fix up the output to bring the results in line with standard meta-analytic practices. For more details, I have written up a more comprehensive [[tips:rma_vs_lm_lme_lmer|comparison of the rma() and the lm(), lme(), and lmer() functions]].
Line 73: Line 73:
 ??? For mixed-effects models, how is the $R^2$ statistic computed by the rma() function? ??? For mixed-effects models, how is the $R^2$ statistic computed by the rma() function?
  
-!!! The pseudo $R^2$ statistic (Raudenbush, 2009) is computed with $$R^2 = \frac{\hat{\tau}_{RE}^2 - \hat{\tau}_{ME}^2}{\hat{\tau}_{RE}^2},$$ where $\hat{\tau}_{RE}^2$ denotes the estimated value of $\tau^2$ based on the random-effects model (i.e., the total amount of heterogeneity) and $\hat{\tau}_{ME}^2$ denotes the estimated value of $\tau^2$ based on the mixed-effects model (i.e., the residual amount of heterogeneity). It can happen that $\hat{\tau}_{RE}^2 < \hat{\tau}_{ME}^2$, in which case $R^2$ is set to zero. Again, the value of $R^2$ will change depending on the estimator of $\tau^2$ used. Also note that this statistic is only computed when the mixed-effects model includes an intercept (so that the random-effects model is clearly nested within the mixed-effects model). You can also use the ''[[https://wviechtb.github.io/metafor/reference/anova.rma.html|anova()]]'' function to compute $R^2$ for any two models that are known to be nested.+!!! The pseudo $R^2$ statistic (Raudenbush, 2009) is computed with $$R^2 = \frac{\hat{\tau}_{RE}^2 - \hat{\tau}_{ME}^2}{\hat{\tau}_{RE}^2} = 1 - \frac{\hat{\tau}_{ME}^2}{\hat{\tau}_{RE}^2},$$ where $\hat{\tau}_{RE}^2$ denotes the estimated value of $\tau^2$ based on the random-effects model (i.e., the total amount of heterogeneity) and $\hat{\tau}_{ME}^2$ denotes the estimated value of $\tau^2$ based on the mixed-effects model (i.e., the residual amount of heterogeneity). It can happen that $\hat{\tau}_{RE}^2 < \hat{\tau}_{ME}^2$, in which case $R^2$ is set to zero. Again, the value of $R^2$ will change depending on the estimator of $\tau^2$ used. Also note that this statistic is only computed when the mixed-effects model includes an intercept (so that the random-effects model is clearly nested within the mixed-effects model). You can also use the ''[[https://wviechtb.github.io/metafor/reference/anova.rma.html|anova()]]'' function to compute $R^2$ for any two models that are known to be nested.
  
 ??? For random-effects models fitted with the rma() function, how is the prediction interval computed by the predict() function? ??? For random-effects models fitted with the rma() function, how is the prediction interval computed by the predict() function?
faq.txt · Last modified: 2023/01/24 07:56 by Wolfgang Viechtbauer