[R-meta] specified weights in rma
Antonia,
The code looks correct to me, and it looks like it is producing the
weighted average just as you specified:
mean_effect <- weighted.mean(effect, w = weight)
all.equal(mean_effect, as.numeric(meta$b), check.attributes = FALSE)
Also, note that the output of weights() is re-scaled to sum to 100, which
is why it does not agree with the inputted weights:
(rma_wt <- weights(meta))
sum(rma_wt)
100 * weight / sum(weight)
all.equal(rma_wt, 100 * weight / sum(weight), check.attributes = FALSE)
Cheers,
James
On Fri, Aug 3, 2018 at 7:10 AM Antonia Sudkaemper <a.sudkaemper at gmail.com>
wrote:
Hello all,
I am trying to run a meta-analysis with specified weights, but even though
the code seems right the analysis seems to apply the default weights rather
than the ones I specify - is there something wrong with the code?
effect = c(2.46, 3.11, 3.93)
error = c(0.44, 0.38, 0.57)
weight = c(5.16, 6.70, 3.05)
study<-c("Study1", "Study2", "Study3")
summary(meta <- rma(yi=effect, sei=error, weights=weight, slab=study))
weights(meta)
Thank you very much for your help.
All the best, Antonia
--
Antonia Sudk?mper
PhD Candidate in Organizational Psychology/University of Exeter
www.antoniasudkaemper.com
a.sudkaemper at gmail.com
[[alternative HTML version deleted]]
_______________________________________________ R-sig-meta-analysis mailing list R-sig-meta-analysis at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis