______________________________________________________________________________________________

 

MAIN PAGE

______________________________________________________________________________________________

 

ML Power Tool

 

NOTE: This program is also available as a graphic user interface and its use does not require knowledge of R: https://aguinis.shinyapps.io/ml_power/

 

Below is the R program “ML Power Tool” for calculating statistical power to detect a cross-level interaction effect as described in the following article:

 

Mathieu, J. E., Aguinis, H., Culpepper, S. A., & Chen. G. (2012). Understanding and estimating the power to detect cross-level interaction effects in multilevel modeling. Journal of Applied Psychology, 97, 951-966. [pdf version

 

Note: Syntax must be run in R (R Development Core Team, 2008) including the Linear mixed-effects models using S4 classes (lme4) module. Users supply values (underlined in the code below). This illustration includes illustrative values from the following source: Chen, G., Kirkman, B. L., Kanfer, R., Allen, D., & Rosen, B. (2007). A multilevel study of leadership, empowerment, and performance in teams. Journal of Applied Psychology, 92, 331-346.

 

l2n = 62               # Level-2 sample size

l1n = 7                #Average Level-1 sample size

iccx = .12             #ICC1 for X

g00 = -0.068364        #Intercept for B0j equation (Level-1 intercept)

g01 = 0.345048         #Direct cross-level effect of average Xj on Y

g02 = 0.022851         #Direct cross-level effect of W on Y

g03 = 0.184721         #Between-group interaction effect between W and Xj on Y

g10 = 0.451612         #Intercept for B1j equation (Level-1 effect of X on Y)

g11 = 0.148179         #Cross-level interaction effect

vu0j = 0.00320         #Variance component for intercept

vu1j = 0.08954         #SD of Level-1 slopes

vresid = 0.76877       #Variance component for residual, within variance

alpha = .05            #Rejection level

REPS = 1000            #Number of Monte Carlo Replications, 1000 recommended

 

hlmmmr <- function(iccx,l2n,l1n,g00,g01,g02,g03,g10,g11,vu0j,vu1j,alpha){

require(lme4)

Wj = rnorm(l2n, 0, sd=1)

Xbarj = rnorm(l2n, 0, sd=sqrt(iccx)) ## Level-2 effects on x

b0 = g00 + g01*Xbarj+ g02*Wj + g03*Xbarj*Wj + rnorm(l2n,0,sd=sqrt(vu0j))

b1 = g10 + g11*Wj + rnorm(l2n,0,sd=sqrt(vu1j))

dat=expand.grid(l1id = 1:l1n,l2id = 1:l2n)

dat$X=rnorm(l1n*l2n,0,sd=sqrt(1-iccx))+Xbarj[dat[,2]]

dat$Xbarj=Xbarj[dat[,2]]

dat$Wj=Wj[dat[,2]]

dat$Y <- b0[dat$l2id]+ b1[dat$l2id]*(dat$X-dat$Xbarj)+rnorm(l1n*l2n,0,sd=sqrt(vresid))

dat$Xc=(dat$X - Xbarj[dat[,2]])

lmm.fit<- lmer(Y ~ Xc+Xbarj+Wj+Xbarj:Wj+Xc:Wj+(Xc|l2id),data=dat)

fe.g <- fixef(lmm.fit)

fe.se <- sqrt(diag(vcov(lmm.fit)))

ifelse(abs(fe.g[6]/fe.se[6])>qt(1-alpha/2,l2n-4),1,0)

}

simout=replicate(REPS,hlmmmr(iccx,l2n,l1n,g00,g01,g02,g03,g10,g11,vu0j,vu1j,alpha))

powerEST=mean(simout)

powerEST

 

______________________________________________________________________________________________

 

MAIN PAGE

______________________________________________________________________________________________