# [R-meta] Sample-size weighting of estimates of response ratios?

Viechtbauer, Wolfgang (NP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Thu Apr 20 17:45:22 CEST 2023

```One doesn't need to specify a covariance matrix (unless we are talking about situations where there are dependent estimates, but I don't think this is what we are discussing here). If one wants to use custom weights with the rma.uni() function, one just specifies them via the 'weights' argument. If one doesn't specify those weights, then the standard 1 / (vi + tau^2) weights are used (in a random/mixed-effects model). In either case, let W be diagonal with the weights along the diagonal, let X be the model matrix, and y the column vector with the effect size estimates. Then the model coefficients are estimated using weighted least squares (which is the same as maximum likelihood estimation in this case) with

b = (X'WX)^-1 X'W y

And the var-cov matrix of the coefficients is therefore given by

Var[b] = (X'WX)^-1 X'W Var[y] WX (X'WX)^-1

When using the default weights, Var[y] = W^-1, in which case the above simplifies to

Var[b] = (X'WX)^-1

When using custom weights, this is no longer true and one has to use the full equation above, where Var[y] is diagonal with vi + tau^2 along the diagonal.

Best,
Wolfgang

>-----Original Message-----
>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On
>Behalf Of Will Hopkins via R-sig-meta-analysis
>Sent: Wednesday, 19 April, 2023 1:55
>To: 'R Special Interest Group for Meta-Analysis'
>Cc: Will Hopkins
>Subject: Re: [R-meta] Sample-size weighting of estimates of response ratios?
>
>Thanks for this reply, Wolfgang. I've searched the metafor documentation for
>"rma.uni" and for "weight matrix", but I can't see how one specifies the
>covariance matrix when weighting is done only by sample size. With the mixed
>model in SAS, weighting by the inverse of the variances is done the long way
>by holding the residual for each study estimate to its variance. (Doing it
>the elegant way is achieved with a weight statement specifying the inverse
>of the variance, and there is a single residual set to unity.) Presumably
>the standard error of each estimate is somehow still included in the meta
>(how else could you get meaningful uncertainty in the mean effect and an
>estimate of heterogeneity?), even though the weighting is only by sample
>size, but I can't see how. Do you still set the covariance matrix to a
>diagonal of the variances, but you now include a weighting by sample size?
>
>Will
>
>-----Original Message-----
>From: Viechtbauer, Wolfgang (NP)
><wolfgang.viechtbauer using maastrichtuniversity.nl>
>Sent: Sunday, April 16, 2023 11:11 PM
>To: R Special Interest Group for Meta-Analysis
><r-sig-meta-analysis using r-project.org>
>Cc: Will Hopkins <willthekiwi using gmail.com>
>Subject: RE: [R-meta] Sample-size weighting of estimates of response ratios?
>
>Dear Will,
>
>metafor allows the user to adjust the weights to any weights deemed
>reasonable. See the 'weights' argument in rma.uni() and the 'W' argument in
>rma.mv() (in the latter case, one can specify an entire weight matrix).
>
>Best,
>Wolfgang
>
>>-----Original Message-----
>>From: R-sig-meta-analysis
>>[mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Will
>>Hopkins via R-sig-meta-analysis
>>Sent: Sunday, 16 April, 2023 3:36
>>To: 'R Special Interest Group for Meta-Analysis'
>>Cc: Will Hopkins
>>Subject: [R-meta] Sample-size weighting of estimates of response ratios?
>>
>>I know that metafor allows meta-analysis of response ratios (aka factor
>>effects or ratios of means), but I can't find in the metafor
>>documentation whether it's possible to weight the individual study
>>estimates with their effective sample size rather than the usual
>>inverse of the square of the standard error.  Bakbergenuly et al.
>>(2020) recommended this approach to reduce the downward bias in the
>meta-analyzed mean ratio and heterogeneity.
>>I am not a user of metafor, but I need to be able to state whether it's
>>available for a manuscript I am revising with a colleague (Dave
>>Rowlands) about better approaches than standardization when meta-analyzing
>means.
>>Wolfgang, is it already available, or if not, do you intend to implement
>it?
>>
>>We use SAS's proc mixed for metas, with the elegant method of setting
>>the residual variance to unity, but I don't know how to adapt this
>>method to weighting by sample size. If anyone on this list can
>>enlighten me, that would also be cool, thank you.
>>
>>Will
>>
>>Bakbergenuly I, Hoaglin DC, Kulinskaya E. Estimation in meta-analyses
>>of response ratios. BMC Med Res Methodol. 2020;20(1):263.
>>doi:10.1186/s12874-020-01137-1

```

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