[R-meta] Questin about Two moderators using R-metafor package

Viechtbauer, Wolfgang (SP) wolfg@ng@viechtb@uer @ending from m@@@trichtuniver@ity@nl
Thu Oct 25 11:02:14 CEST 2018


Dear Yumi,

As Michael said, please post in plain text. 

But the problem stems from taking out$b[1] and out$b[2] (and the same for the CI bounds). The first coefficient is the intercept. You should be saving out$b[2] and out$b[3].

As a side-note: You wrote that the 'effect size is Pearson correlation'. But you are not simulating correlations. You are simulating outcomes that have a normal distribution, but Pearson correlations do not have a normal sampling distribution. Also, in your code, the sampling variances are exactly known. That is also not the case for Pearson correlations. Since you are using a variance of 1/(n-3), this appears to be an attempt to simulate Fisher r-to-z transformed correlation coefficients, but this isn't the right way to do this. One would really have simulate correlation coefficients and then transform them.

Best,
Wolfgang

-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Michael Dewey
Sent: Thursday, 25 October, 2018 10:36
To: Yumi; Q about R
Subject: Re: [R-meta] Questin about Two moderators using R-metafor package

At least here your post is very hard to read since you posted in HTML 
which gets mangled on a plain text mailing list. Perhaps re-post in 
plain text? Also can you clarify what you mean by bias and power here 
and what you K values are doing?

Michael

On 25/10/2018 03:20, Yumi wrote:
> Dear all,
>  
> I am doing a simulation study that includes two moderators in Meta-regression and investigate how the Accuracy of Parameter Estimation changes with the Number of Primary Studies included.
> The effect size is Pearson correlation, and I use the rma.uni() in metafor package. The equation is  yi<-0+xi*��1+xj*��2+e, and the two  regression coefficients are ��1 and ��2.
> I found an interesting phenomenon that Bias and Power on the estimation of ��1 are far different from ��2.
> When K=20,40,60,80,100,120,
> I got the results as following:
> Bias1=-0.49,-0.50,-0.49,-0.50,-0.50,-0.49
> Bias2=0.00,-0.00,-0.00,-0.00,0.00,-0.00
> Power1=0.0504, 0.0522, 0.0543, 0.052, 0.0499, 0.0506
> Power2=0.9988, 1, 1, 1, 1, 1
> I was wondering if it is meaningful to discuss the big differences between the results on two coefficients or I can just take the mean value between Bias1 and Bias2.
> 
> Sincerely,
> Fang
> 
> The statements are as following.
> 
> library(metafor)
> 
> K<-20   #K=20,40,60,80,100,120
> 
> ��1<-0.2
> 
> ��2<-0.2
> 
> tau2<-0.32
> 
> output<-list(id=NULL,beta1=NULL,beta2=NULL,ci.lb1=NULL,ci.ub1=NULL,ci.lb2=NULL,ci.ub2=NULL)
> 
> for(i in 1:1000)
> 
> {output$id<-append(output$id,i)
> 
> nn<-rlnorm(K, meanlog =1,sdlog=0.9)
> 
> n<- round(nn*K)
> 
> n[n<25]<-25
> 
> n[n>1000]<-1000
> 
> vv<-1/(n-3)
> 
> vi<-sqrt(vv)
> 
> e<-rnorm(K, mean = 0, sd = sqrt(vv + tau2))
> 
> xi<-rnorm(K)
> 
> xj<-rnorm(K)
> 
> yi<-0+xi*��1+xj*��2+e
> 
> out<-rma.uni(yi,vi, mods=~xi+xj, tau2=tau2,test="knha",method="DL")
> 
> output$beta1<-append(output$beta1,out$b[1])
> 
> output$beta2<-append(output$beta2,out$b[2])
> 
> output$ci.lb1<-append(output$ci.lb1,out$ci.lb[1])
> 
> output$ci.ub1<-append(output$ci.ub1,out$ci.ub[1])
> 
> output$ci.lb2<-append(output$ci.lb2,out$ci.lb[2])
> 
> output$ci.ub2<-append(output$ci.ub2,out$ci.ub[2])
> 
> write.table(output,"D:/20-0.2-0.2-0.32.txt")
> 
> }


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