[R-meta] specified weights in rma
Viechtbauer, Wolfgang (SP)
wolfg@ng@viechtb@uer @ending from m@@@trichtuniver@ity@nl
Mon Aug 6 15:38:28 CEST 2018
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:
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.
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Antonia Sudkaemper
Sent: Monday, 06 August, 2018 11:58
To: James Pustejovsky
Cc: r-sig-meta-analysis using r-project.org
Subject: Re: [R-meta] specified weights in rma
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 using gmail.com> wrote:
> 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))
> 100 * weight / sum(weight)
> all.equal(rma_wt, 100 * weight / sum(weight), check.attributes = FALSE)
> On Fri, Aug 3, 2018 at 7:10 AM Antonia Sudkaemper <a.sudkaemper using gmail.com>
>> 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
>> 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))
>> Thank you very much for your help.
>> All the best, Antonia
>> Antonia Sudkämper
>> PhD Candidate in Organizational Psychology/University of Exeter
>> a.sudkaemper using gmail.com
More information about the R-sig-meta-analysis