reveal<-function(tplot=NULL){ #analysis of Ottawa Global Rating Scale reliability and validty. #tplot: Which plot? #tplot='overall' Plot of overall grs italian vs english #tplot='skill' Plot of Italian GRS overall vs skill score library(psych); # #GRS SCORES reveal.df<-mydf(sql='SELECT * FROM grs ORDER BY team,station',db='reveal'); reveal.df$language<-as.factor(reveal.df$language); #reveal.df<-reveal.df[with(data=reveal.df,expr=order(language,team,station)),]; grs.eng<-subset(x=reveal.df,language=='english'); grs.it<-subset(x=reveal.df,language=='italian'); #SKILL SCORES reveal.skill.df<-mydf(sql='SELECT * FROM SKILL ORDER BY team,station',db='reveal'); reveal.skill.df$fscore<-reveal.skill.df$score/reveal.skill.df$maxscore; bonf.conf.level<-1-(0.05/7);#bonferroni correction for 7 tests 95% if(all.equal(grs.it$station,grs.eng$station)){ cor.overall<-cor.test(grs.eng$overall,grs.it$overall,conf.level=bonf.conf.level); cor.leadership<-cor.test(grs.eng$leadership,grs.it$leadership,conf.level=bonf.conf.level); cor.solving<-cor.test(grs.eng$solving,grs.it$solving,conf.level=bonf.conf.level); cor.awareness<-cor.test(grs.eng$awareness,grs.it$awareness,conf.level=bonf.conf.level); cor.utilization<-cor.test(grs.eng$utilization,grs.it$utilization,conf.level=bonf.conf.level); cor.communication<-cor.test(grs.eng$communication,grs.it$communication,conf.level=bonf.conf.level); }else{ cor.overall='null'; } if(all.equal(grs.it$station,reveal.skill.df$station)){ cor.skill<-cor.test(grs.it$overall,reveal.skill.df$fscore,conf.level=bonf.conf.level); }else{ cor.skill='null'; } p.values<-c(cor.overall$p.value,cor.leadership$p.value,cor.solving$p.value,cor.awareness$p.value,cor.utilization$p.value,cor.communication$p.value,cor.skill$p.value); names(p.values)<-c('overall','leadership','solving','awareness','utilization','communication','skill'); p.corrected<-p.adjust(p.values,method='holm'); #Post-hoc exploratory analysis chron.it<-alpha(grs.it[,c(7:12)]); #PLOTS PLOTS PLOTS if (tplot=='overall'){ overall.lm<-lm(grs.it$overall~grs.eng$overall); plot(jitter(grs.it$overall)~jitter(grs.eng$overall),ylab="Italian Overall GRS /7",xlab="English Overall GRS /7",main="Correlation Between Italian Overall GRS and English Overall GRS",ylim=c(1,7),xlim=c(1,7)); abline(overall.lm); } else if(tplot=='skill'){ skill.lm<-lm(grs.it$overall~I(reveal.skill.df$fscore*100)); plot(jitter(grs.it$overall)~I(reveal.skill.df$fscore*100),ylab="Italian Overall GRS /7",xlab="Skill Score /100",main="Correlation Between Italian Overall GRS and Skill Score",ylim=c(1,7),xlim=c(0,100)); abline(skill.lm); } #Return Results return(list( cor.overall=cor.overall, cor.leadership=cor.leadership, cor.solving=cor.solving, cor.awareness=cor.awareness, cor.utilization=cor.utilization, cor.communication=cor.communication, cor.skill=cor.skill, p.corrected=p.corrected, chron.it=chron.it )); }