#Chapter 6 Script #creating scatterplots library (car) #this activates the car library, which has the scatterplot command scatterplot (proneng~aoa, data=flegeetal1999) #modyfying a scatterplot in r console scatterplot(PronEng~AOA, reg.line=lm, smooth=TRUE, labels=FALSE, boxplots='xy', span=0.5, xlab="Age of arrival", ylab="Pronunciation score", cex=1.6, data=flegeetal1999) #Viewing Simple Scatterplot Data by Categories dekeyser$Status<-factor(dekeyser$Status) scatterplot(GJTScore~Age | Status, by.groups=TRUE, data=dekeyser) #multiple scatterplots library (car) scatterplot.matrix(~age+aptscore+useeng, reg.line=lm, smooth=TRUE, span=0.5, diagonal = 'density', data=larsonhall2008) #calculating correlation coefficients library(Hmisc, pos=4) rcorr.adjust(larsonhall2008[,c("aptscore","gjtscore","totalhrs")], type="pearson") cor.test(larsonhall2008$gjtscore, larsonhall2008$aptscore, method="kendall") #robust correlation library(mvoutlier) attach(dekeyser) cor.plot(Age,GJTScore) library(MASS) cov.rob(cbind(Age,GJTScore),cor=T) #notice that the variables get bound together using #cbind() detach(dekeyser) cor(AGE, GJTSCORE, method="spearman") #partial correlation partial.cor(partial[,c("age","LOR","aptitude")], use="complete.obs") #point-biserial correlations and inter-rater reliability reliability(cov(LHtest[,c("Q43","Q44","Q45","TotalScore")], use="complete.obs")) #inter-rater reliability reliability(cov(MDM[,c("m001","m002","m003","m004","m005","m006","m007", "m008","m009","m010")], use="complete.obs")) rcorr.adjust(MDM[c("m001","m002","m003","m004","m005","m006","m007","m008", "m009","m010")],type="pearson") library(psych) alpha(LHtest) rcorr.adjust(MDM[c("m001","m002","m003","m004","m005")],type="pearson")