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

Michael Dewey li@t@ @ending from dewey@myzen@co@uk
Thu Oct 25 10:36:11 CEST 2018

```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")
>
> }
>
>
>
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
>
>
> _______________________________________________
> R-sig-meta-analysis mailing list
> R-sig-meta-analysis using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
>

--
Michael
http://www.dewey.myzen.co.uk/home.html

```