###The following code outlines methods to calculate Hedges effect sizes and associated confidence intervals. ###Methods follow: #Gurevitch, J., Morrison, J.A. & Hedges, L.V. (2000) The interaction between competition and predation: A meta-analysis of field experiments. American Naturalist, 155, 435-453. #Hedges, L.V. & Olkin, I. (1985) Statistical methods for meta-analysis. Academic Press, Boston, Massachuessets, USA. #Morris, W.F., Hufbauer, R.A., Agrawal, A.A., Bever, J.D., Borowicz, V.A., Gilbert, G.S., Maron, J.L., Mitchell, C.E., Parker, I.M., Power, A.G., Torchin, M.E. & Vazquez, D.P. (2007) Direct and interactive effects of enemies and mutualists on plant performance: A meta-analysis. Ecology, 88, 1021-1029. ###Basic parameters of the study required for four treatments (Control, A, B, A*B): number of replicates, mean, standard deviation ####Input parameters#### ##Number of samples## #No. replicates in Control nc<-12 #No. replicates Treatment A na<-12 #No. replicates Treatment B nb<-12 #No. replicates Treatment A*B nab<-12 ##Means## #Mean in Control mc<-0 #Mean in Treatment A ma<-0.3 #Mean in Treatment B mb<-.13 #Mean in Treatment A*B mab<-0.14 ##Standard deviations## #stdev in control sc<-0.22 #stdev in treat A sa<-0.51 #stdev in treat B sb<-.52 #stdev in treat A*B sab<-.52 ###Calculate pooled standard deviations### #calculate pooled standard deviation of Treatment A and Control pooledAC<-sqrt(((na-1)*sa^2+(nc-1)*sc^2)/(na+nc-2)) #calculate pooled standard deviation of Treatment B and Control pooledBC<-sqrt(((nb-1)*sb^2+(nc-1)*sc^2)/(nb+nc-2)) #calculate pooled standard deviation across all four groups pooledAll<-sqrt(((na-1)*(sa^2)+((nb-1)*(sb^2))+((nc-1)*(sc^2))+((nab-1)*(sab^2)))/(na+nb+nc+nab-4)) ###Calculate J(m) small-sample bias correction### #for effect A Jma<-1-(3)/((4*(na+nc-2))-1) #for effect B Jmb<-1-(3)/((4*(nb+nc-2))-1) #for interaction Jmi<-1-(3)/((4*(nc+na+nb+nab-4))-1) ###Calculate individual effects and their sampling variances### #Calculate individual effect of A da<-((ma-mc)/pooledAll)*Jma #Calculate individual effect of B db<-((mb-mc)/pooledAll)*Jmb #Calculate sampling variance of individual effect A sv_a<-((1/na)+(1/nc)+((da^2)/(2*(na+nc)))) #Calculate sampling variance of individual effect A sv_b<-((1/nb)+(1/nc)+((db^2)/(2*(nb+nc)))) ###Calculate confidence intervals for individual effects of A and B CI_a_low<-da-(1.96*sqrt(sv_a)) CI_a_high<-da+(1.96*sqrt(sv_a)) CI_b_low<-db-(1.96*sqrt(sv_b)) CI_b_high<-db+(1.96*sqrt(sv_b)) ###Calculate main effects of A and B #Main effect of A dA<-(((ma+mab)-(mb+mc))*Jmi/(2*pooledAll)) #Main effect of B dB<-(((mb+mab)-(ma+mc))*Jmi/(2*pooledAll)) ###Calculate interaction effect size and sampling variance #Interaction effect dI<-(((mab-mb)-(ma-mc))*Jmi/(pooledAll)) #Interaction variance vI<-((1/na)+(1/nb)+(1/nc)+(1/nab)+((dI^2)/(2*(na+nb+nc+nab)))) ###Calculate interaction confidence interval ICI_low<-dI-(1.96*(sqrt(vI))) ICI_high<-dI+(1.96*(sqrt(vI)))