library("robumeta") library("metafor") library("dplyr") library("meta") library(xlsx) #to allow for loading excel sheet library("varhandle") #to allow for handling factors library(multcomp) library(dplyr) library(tidyr) library(tidyverse) #read data and only include the ones with "Y" included data<-read.xlsx("LENA_Prediction.xlsx",1,rm.na=TRUE) data<-subset(data,Included =="Y") #Calculated weighted effect szies for repeated measures weighted<-data %>% group_by(Study.Index,Population,Measure) %>% summarize(Weightedr = sum(r*N)/sum(N),WeightedN = mean(N), WeightedRecAge=sum(AgeRecording..m.*N)/sum(N),WeightedGap=sum(Agegap*N)/sum(N)) #subset data to create unique variables data1 <- subset(data, subset = !duplicated(data[c("Study.Index", "Population","Measure")]), select = c("Study.Index", "Population","Type", "Female.N","Language","Measure","N","Country")) #prepare data for analysis final<-merge(data1, weighted, by = c("Study.Index", "Population","Measure")) final<-read.xlsx("LENA_Mod.xlsx",1,rm.na=TRUE) # all data Gap<-subset(final,Study.Index !="Gilkerson et al. (2018)") #data without Gilkerson 2015 for the moderator analysis of gap Population<-subset(final,Population !="Mixed") #data without the "mix" group for the moderator analysis of developmental status Languagemodality<-subset(final,Languagemodality !="Composite") #data without the "composite" measure for the moderator analysis of language modality Testtype<-subset(final,Testtype !="Composite") #data without the "composite" measure for the moderator analysis of test methods #ran meta-analsys on the correaltion, using Measure (AWC, CV, CT) as subgroups; create funnel and forest plots. #Replace the measure of interest to obtain correlation values for other factors. metacor(final$Weightedr,round(final$WeightedN,digits=0),final$Study.Index,sm="ZCOR",byvar=final$Measure,comb.fixed=F)->mainALL summary(mainALL) pdf("main4.pdf",width=9,height=13) funnel(mainALL) forest.meta(mainALL,pooled.totals=F,pooled.events=F,hetstat=F, backtransf=FALSE,digits.weight=2) dev.off() # Snesitivity analyses in whcih each unique sample size was excluded one at a time did not substantially alter the results, suggesting that #ni single effect size unduly influened the overall mean effect size metainf(mainALL, pooled="random") #Moderator analyses, plots. ##Replace data=Testtype and ~Type with other data and moderators to obtain results. dat <- escalc(measure="ZCOR", ri=Weightedr, ni=WeightedN, data=Testtype, slab=paste(Study.Index, Population, sep=", ")) res <- rma(yi, vi, data=dat) res.modage <- rma(yi, vi, mods = ~ Testtype, data=dat,method = "REML") res.modage anova(res.modage) #Figure 4, examing the effect of the moderator "gap" on the correlation between lena automated measures and language preds <- predict(res.modage, newmods = cbind(0:120),transf = exp) wi <- 1/sqrt(dat$vi) size <- 0.5 + 3 * (wi - min(wi))/(max(wi) - min(wi)) #plots for Fig 4 plot(dat$WeightedGap, exp(dat$yi), pch = 19, cex = size, xlab = "Weighted Gap", ylab = "Effect size transformed", las = 1, bty = "l", log = "y") lines(0:120, preds$pred,lty = "dashed",col = 'red') lines(0:120, preds$ci.lb, lty = "dashed") lines(0:120, preds$ci.ub, lty = "dashed") abline(h = 1, lty = "dotted")