[R-meta] specified weights in rma
Aw, great, that is very useful, thanks a lot! All the best, Antonia On 6 August 2018 at 14:38, Viechtbauer, Wolfgang (SP) <
wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
The weights are only rescalled to percentages when using weights(). Internally, the unscalled weights are used for the computations. If you want to see the unscalled weights, you could use: diag(weights(meta, type="matrix")) weights(meta, type="matrix") gives the whole weight matrix (which is diagonal for models fitted with rma()) without any rescalling and then diag() gives you just the diagonal. Best, Wolfgang -----Original Message----- From: R-sig-meta-analysis [mailto:r-sig-meta-analysis- bounces at r-project.org] On Behalf Of Antonia Sudkaemper Sent: Monday, 06 August, 2018 11:58 To: James Pustejovsky Cc: r-sig-meta-analysis at r-project.org Subject: Re: [R-meta] specified weights in rma Hello James, thank you very much for your reply, that was very useful - I hadn't realised the numbers were re-scaled versions of the ones I had specified! If I understand this correctly then, the re-scaling does not effect my results, i.e. mean, confidence intervals, p-value? Thank you very much. All the best, Antonia On 3 August 2018 at 14:55, James Pustejovsky <jepusto at gmail.com> wrote:
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
Antonia Sudk?mper PhD Candidate in Organizational Psychology/University of Exeter www.antoniasudkaemper.com a.sudkaemper at gmail.com [[alternative HTML version deleted]]