## 14.2 Random-Effects Model

For power analyses under the random-effects model, the formula to calculate the variance of my true mean effect looks slightly different:

$V_{\delta}^*=\frac{V_Y+\tau^2}{k}$

We see that again, $$tau^2$$ has to be included to take the between-study heterogeneity into account (see Chapter 4.2 for more details). However, i do not know the between-study heterogeneity of my analysis before i perform it, so what value should i assume?

According to Hedges and Pigott (Hedges and Pigott 2004), the follwing formulae may be used to calculate the power in the random-effect model assuming small, moderate or high heterogeneity:

Small heterogeneity:

$V_{\delta}^*=1.33\times\frac{V_Y}{k}$

Moderate heterogeneity:

$V_{\delta}^*=1.67\times\frac{V_Y}{k}$

Large heterogeneity:

$V_{\delta}^*=2\times\frac{V_Y}{k}$

Again, you don’t have to worry about the statistical details here. We have put the entire calculations into the power.analysis.random function, which can be found below.

Again, R doesn’t know this function yet, so we have to let R learn it by copying and pasting the code underneath in its entirety into the console on the bottom left pane of RStudio, and then hit Enter ⏎.

power.analysis.random<-function(d,k,n1,n2,p,heterogeneity){

n1<-n1
n2<-n2
d<-d
k<-k
p<-p
heterogeneity<-heterogeneity

if(heterogeneity=="low"){

v.d<-((n1+n2)/(n1*n2))+((d*d)/(2*(n1+n2)))
v.m<-v.d/k
v.m<-1.33*v.m
lambda<-(d/sqrt(v.m))
plevel<-1-(p/2)
zval<-qnorm(p=plevel, 0,1)
power<-1-(pnorm(zval-lambda))+(pnorm(-zval-lambda))
return(power)
}

if(heterogeneity=="moderate"){

v.d<-((n1+n2)/(n1*n2))+((d*d)/(2*(n1+n2)))
v.m<-v.d/k
v.m<-1.67*v.m
lambda<-(d/sqrt(v.m))
plevel<-1-(p/2)
zval<-qnorm(p=plevel, 0,1)
power<-1-(pnorm(zval-lambda))+(pnorm(-zval-lambda))
return(power)
}

if(heterogeneity=="high"){

v.d<-((n1+n2)/(n1*n2))+((d*d)/(2*(n1+n2)))
v.m<-v.d/k
v.m<-2*v.m
lambda<-(d/sqrt(v.m))
plevel<-1-(p/2)
zval<-qnorm(p=plevel, 0,1)
power<-1-(pnorm(zval-lambda))+(pnorm(-zval-lambda))
return(power)
}

}

Now you are set and ready to use the function. I will assume the same parameters from before, but this time i will also have to specify the heterogeneity in the function, which can take the values "low", "moderate" and "high". I will choose "moderate" for this example.

power.analysis.random(d=0.30,k=10,n1=25,n2=25,p=0.05,
heterogeneity = "moderate")

The output i get is:

## [1] 0.7327163

Interestingly, we see that this value is 73%, which is smaller than the value of 91% which was calculated using the fixed-effect model. The value is also below 80%, meaning that i would not have optimal power to find the desired effect of $$d=0.30$$ to be statistically significant if it exists.

This has to do with the larger heterogeneity i assume in this simulation, which decreases the precision of my effect size estimate, and thus increases my need for statistical power.

The graph below visualizes this relationship:

### References

Hedges, Larry V, and Therese D Pigott. 2004. “The Power of Statistical Tests for Moderators in Meta-Analysis.” Psychological Methods 9 (4). American Psychological Association: 426.