[R-meta] Standard error of heterogeneity with rma.uni

Will Hopkins w|||thek|w| @end|ng |rom gm@||@com
Sun Mar 3 22:14:55 CET 2024


After a year of denial, a colleague and I are starting to use metafor
instead of SAS's Proc Mixed, since finding recently that selection models to
adjust for publication bias are not implementable in SAS (not by us, anyway,
and no-one else seems to be using SAS for meta-analyses). So I'm starting by
importing data into R that I have simulated and analyzed in SAS, to make
sure I am using metafor correctly. I have found that the standard error (SE)
for the heterogeneity variance provided by rma.uni is considerably smaller
than that provided by SAS, and the SE for a fixed effect can be smaller in
metafor, too. Here are two examples. Along the way, I have several questions
I hope you or someone can answer, Wolf.

In the first example, there were 20 studies (10 female, 10 male), with
sample size ranging from 10 to 30, with small and moderate mean changes for
males and females respectively, small heterogeneity within each group, and
standard errors of measurement such that the mean changes in most of the
male studies were non-significant and most of the females were significant.
("Small" is not trivial, "small" and "moderate" are not defined by
standardization. In the following examples, small and moderate mean changes
are 1 and 3, and small heterogeneity is and SD of 0.5.) 

The code for metafor was:
rma.uni(yi=Ydelta, vi=YdeltaSEsq, mods=Female01, data=simraw).
(Female01 is a dummy variable.) The solution for fixed effects was the same
in metafor...
                estimate    se       
intrcpt    0.9546       0.3819 
mods      2.1568       0.5162
...as in SAS...
Effect         Estimate   StdErr
Mean         0.9546      0.3819
Female01  2.1568      0.5162

But for the heterogeneity, metafor produced...
tau^2 (estimated amount of residual heterogeneity):     0.2755 (SE = 0.3810)
...while SAS produced...
CovParm     Estimate	StdErr
StudyID	       0.2755	0.5256	

As you can see, the point estimates are the same, but the SE in metafor 0.72
that in SAS.  I presume SAS is correct, because I can use the simulation in
SAS to generate thousands of meta-analyses for given population values of
everything, and the coverage of the confidence intervals for the estimates
of heterogeneity is exactly the level of confidence of the intervals (I use
90%, for various good reasons). Is this a small-sample issue in the way you
produce the SE in rma.uni, Wolf, one that is not a problem in SAS?  Is there
a solution in metafor? Will this matter, when I come to use selmodel? And
will selmodel work with negative values of heterogeneity variance?

In the second example, I used simulated data that produced negative
heterogeneity variance in SAS. I am "brave enough to step into risky
territory", to quote you from the documentation, Wolf, because negative
variance for point estimates and confidence limits are necessary to get
realistic unbiased estimates and correct coverage of random effects, when
the uncertainty in heterogeneity is large enough relative to its true point
estimate, so I wanted to make sure rma.uni produced correct negative
variance. When I asked this mailing list about getting negative variance a
year ago, James Pustejovsky provided the code (which is also in the metafor
documentation):
rma(yi = yi, vi = vi, data=dat, control=list(tau2.min=-min(vi))).

Unfortunately the above code doesn't quite work for me. Here's the line of
code for my data:
rma.uni(yi=Ydelta, vi=YdeltaSEsq, mods=Female01, data=simrawnv,
control=list(tau2.min=-min(vi)))
I got this error:
Error in min(vi) : invalid 'type' (closure) of argument.
And when I tried this...
rma.uni(yi=Ydelta, vi=YdeltaSEsq, mods=Female01, data=simrawnv,
control=list(tau2.min=-min(YdeltaSEsq)))
...I got this...
Error: object 'YdeltaSEsq' not found.
But I got it to work with this...
rma.uni(yi=Ydelta, vi=YdeltaSEsq, mods=Female01, data=simrawnv,
control=list(tau2.min=-99))
...which gave this message...
Warning message:
Value of 'tau2.min' constrained to -min(vi) = -0.1640. 
So there's a bug, but it's easy to bypass it meantime.

The point estimates of the fixed effects in metafor and SAS were identical,
but the SE for the intercept (males) in metafor...
                 estimate      se        
intrcpt    1.3013         0.0013 
mods      1.9245         0.2063
...was 0.67 times than in SAS...
Effect         Estimate  StdErr
Mean        1.3013     0.001930
Female01 1.9245     0.2063

The SE for heterogeneity in metafor...
tau^2 (estimated amount of residual heterogeneity):     -0.1640 (SE =
0.0735)
... was less than half that in SAS...
CovParm  Estimate  StdErr
StudyID   -0.1640     0.1636

Should I be disappointed that both SAS and metafor set the point estimate of
negative variance to minus the smallest variance of the study estimates? It
seems a pretty arbitrary and clunky thing to do, "to ensure that the
marginal variances are always non-negative", to quote Wolf in the
documentation. Perhaps someone can explain that. It obviously works as far
as coverage is concerned, in SAS anyway.

These problems presumably go away with large-enough numbers of studies
and/or sample sizes and/or study-estimate SEs relative to effect magnitudes
and/or heterogeneity, but mainly I am working with small numbers of studies,
small sample sizes, often large(-ish) study-estimate SEs relative to effect
magnitudes, and small heterogeneity. What to do?  Bootstrap in metafor?

The main issue for me is whether I will be able to use selmodel to adjust
for publication bias, when the study estimates are such that negative
heterogeneity could arise purely from sampling uncertainty or from
publication bias (which results in underestimation of heterogeneity, in our
simulations), and will surely arise in simulations aimed at estimating bias
and coverage.

Will



More information about the R-sig-meta-analysis mailing list