[R-meta] Question about inverse variance weighting using the Metafor package
Viechtbauer, Wolfgang (SP)
wolfg@ng@viechtb@uer @ending from m@@@trichtuniver@ity@nl
Mon Jul 30 12:54:23 CEST 2018
Dear Howard,
1) Not sure what this step is supposed to do. It is not a pooled variance in the usual sense (https://en.wikipedia.org/wiki/Pooled_variance). Also, I am not sure where this value is coming back in the further steps.
2) This indeed computes the observed mean differences and corresponding sampling variances.
3) Is 'var_total' what you compute under step 1? Then I wouldn't do that. You should use weights that correspond to the inverse of the sampling variances, not the sum of the two sample variances (note: sample variance != sampling variance of the mean difference -- the sampling variance involves the sample sizes). So, just use:
rma(yi, vi, method="FE", data=fig_1)
4) Same thing, plus plus you are fitting a random-effects model here. Unless you have very good reasons for deviating from the default weights, just use:
rma(yi, vi, data=fig_1)
(method="REML" is the default).
As for some discussion of the use of custom weights, see here:
https://stat.ethz.ch/pipermail/r-sig-meta-analysis/2018-July/000909.html
But using 1/(sd_controls^2+sd_treatment^2) as weights makes little sense in any case.
Best,
Wolfgang
-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Howard Friedman
Sent: Sunday, 29 July, 2018 21:25
To: r-sig-meta-analysis using r-project.org
Subject: [R-meta] Question about inverse variance weighting using the Metafor package
I am using the Metafor package for the first time. I read the
documentation and wanted to confirm that I am doing the correct steps to
computing the weighted mean difference where the weights are inverse
variance.
My data set has inputs for each study of n_control, n_treatment,
mean_controls, mean_treatment, sd_controls, and sd_treatment. Am I correct
that to do the inverse weighting I need to do the following:
(1) Compute the pooled variance by defining variance= sd_controls^2+
sd_treatment^2
(2) Define my variables as below:
fig_1 <- escalc(n1i = n_controls, n2i = n_treatment, m1i = mean_controls,
m2i = mean_ treatment, sd1i = sd_controls, sd2i = sd_ treatment, data =
fig_1, measure = "MD", append = TRUE)
(3) Then for my fixed effects model weighting by 1/variance, run
rma(yi, vi, method="FE",weights=1/var_total,data=fig_1)
(4) And for my variable effects model weighted by 1/variance, run
rma(yi, vi, weights=1/var_total,data=fig_1)
Appreciate you feedback or corrections on this approach.
Thank you,
Howard
--
Columbia University School of International and Public Affairs; School of
Public Health
www.linkedin.com/in/howard-friedman-590ba8
www.Howard-Friedman.com
More information about the R-sig-meta-analysis
mailing list