Skip to content

Commit

Permalink
Implemented Wolfgang's dfs argunent.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel1noble committed May 22, 2021
1 parent 59dcd7a commit 537c840
Show file tree
Hide file tree
Showing 2 changed files with 1,639 additions and 199 deletions.
18 changes: 12 additions & 6 deletions Supplemental_Implementation_Example.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
```

```{r klippy, echo=FALSE, include=TRUE}
install.packages("devtools")
#install.packages("devtools")
remotes::install_github("rlesur/klippy")
klippy::klippy(tooltip_message = 'Click to Copy Code', tooltip_success = 'Done', position = 'right', color = "red")
```
Expand All @@ -46,9 +46,13 @@ First, we'll load some of the packages that we'll need.
# Loading packages & Functions
install.packages("pacman")
remotes::install_github("wviechtb/metafor"); library(metafor)
pacman::p_load(tidyverse, MASS, kableExtra, gridExtra, MCMCglmm, brms, robumeta, clubSandwich, pander, tidyverse)
#install.packages("pacman")
# Note. To get the latest development versuon of metafor use the follow code
#remotes::install_github("wviechtb/metafor"); library(metafor)
# Load packages
pacman::p_load(tidyverse, MASS, kableExtra, gridExtra, metafor, MCMCglmm, brms, robumeta, clubSandwich, pander, tidyverse)
```

# Simulating Non-independent Effect Size Data
Expand Down Expand Up @@ -126,16 +130,18 @@ First, lets just fit our multilevel meta-analytic (MLMA) model. We can do that u
```
We have fit a simple MLMA model that estimates the overall meta-analytic mean. We can see that our model estimates this correctly. Remember that the true mean is `r mu`, and we are pretty close to this value (i.e., `r mod_multilevel$beta`). This is also true of our random effect variance estimates. In this case, we know that the MLMA model is ignoring the shared sampling variance dependence in effect sizes. We expect that this 'should' (at least on average) inflate Type I error rates. Assuming we did not know any better we would want to account for this dependence. Below, we describe a few corrections that meta-analysts can apply that should overcome the problems associated with not accounting for effect size dependence.

Before moving on to some useful corrections, users should be aware that the most up-to-date version of `metafor` (version 2.5-101) does now provide users with some protection against Type I errors. Instead of using the number of effect sizes in the calculation of the degrees of freedom the user instead can make use of the total numbers of papers instead. We show in our simulations that a "papers-1" degrees of freedom can be fairly good. This can be implemented as follows:
Before moving on to some useful corrections, users should be aware that the most up-to-date version of `metafor` (version 2.5-101) does now provide users with some protection against Type I errors. Instead of using the number of effect sizes in the calculation of the degrees of freedom we can instead make use of the total numbers of papers instead. We show in our simulations that a "papers-1" degrees of freedom can be fairly good. This can be implemented as follows after installing the development version of `metafor` (see "R Packages Required" above):

```{r fitmodel, class.source='klippy'}
```{r fitmodel2, class.source='klippy'}
mod_multilevel_pdf = rma.mv(yi = yi, V = vi, mods = ~1,
random=list(~1|study_id,~1|obs),
data=data, test="t", dfs = "contain")
summary(mod_multilevel_pdf)
```

We can see here that the df for the model has changes from 149 to 29, and the p-value has been adjusted accordingly.

# Correction using Robust Variance Estimator (RVE) with Saitterwaite Degrees of Freedom Correction

A very simple solution is to make use of robust variance estimators (RVE). This can be done in a few packages, but very easily using the `clubSandwich` package [@Pustejovsky2020; @Hedges2010; @Tipon2015], which also works well with `metafor` [@Wolfgang2010] models. This approach also makes use of a Saitterwaite degrees of freedom correction [@SW; @Tipon2015]. This works with `metafor` objects quite elegantly. The benefit of such an approach is simply that we need not make any assumptions about what the correlation between effect sizes actually is (assuming we didn't know the true correlation) [@Hedges2010; @Tipon2015]. In addition, it also will account for possible heteroscedascity. This solution can be implemented as follows using our MLMA model we fit in the above section.
Expand Down
1,820 changes: 1,627 additions & 193 deletions Supplemental_Implementation_Example.html

Large diffs are not rendered by default.

0 comments on commit 537c840

Please sign in to comment.