A Guide to Doing Statistics in Second Language Research Using R Chapter 9: T-Tests # 9.1 箱ひげ図の作成 boxplot(recprescore~group, ylab="recprescore", xlab="group", data=leow) identify(leow\$group, leow\$recprescore) # 9.1.2 従属変数の連鎖の箱ひげ図（対応あるt検定） attach(french) boxplot(anwr_1,anwr_2,enwr_1,enwr_2,ylab="Score on test out of 40", names=c("Arabic Time 1","Arabic Time 2","English Time 1","English Time 2"),las=1,notch=TRUE,col="grey",boxwex=.5,ylim=range(c(1,40)),medcol="white") # 9.1.3 グループに分かれた従属変数の箱ひげ図 par(mfrow=c(1,2)) levels(leow\$group)=c("NTA", "ThinkAloud") #Make labels shorter so they‘ll print boxplot(proprescore~group,data=leow,ylim=range(c(0,5)),col="gray", main="Productive pre-tests",boxwex=.5) boxplot(propostscore~group,data=leow,ylim=range(c(0,5)),col="gray", main="Productive post-tests",boxwex=.5) # 9.3独立サンプルt検定の実行 t.test(propostscore~group, alternative='two.sided', conf.level=.95, var.equal=FALSE, data=leow) ＃9.4 Robust独立サンプルt検定の実行 * WRSが用いられない* >Library(WRS) >propostscoreNTA <- subset(leow, subset=group=="NTA", select=c(propostscore)) #n=30 propostscoreTA <- subset(leow, subset=group=="ThinkAloud", select=c(propostscore)) #n=37 trimpb2 (propostscoreNTA, propostscoreTA, tr=.2, alpha=.05, nboot=2000, win=F) # 9.6 対応のあるt検定の実行 #アラビア語 t.test(french\$anwr_1,french\$anwr_2,alternative='two.sided', conf.level=.95, paired=TRUE) ＃英語 t.test(french\$enwr_1,french\$enwr_2,alternative='two.sided', conf.level=.95, paired=TRUE) # 9.7 Robust対応のあるt検定 * WRSが用いられない* rmmcppb(french\$ANWR_1, french\$ANWR_2, alpha=.05, est=mean, tr=.2, dif=T, nboot=2000, BA=T, hoch=F) # 9.9 1標本t検定を実行する t.test(torres\$grammar, alternative='two.sided', mu=3, conf.level=.95) #9.10 Robust1標本t検定の実行 * WRSが用いられない* trimpb(torres\$grammar, tr=.2, alpha=.05, nboot=2000,WIN=F,null.value=3) mean(torres\$PRON,tr=.2) https://onlinecourses.science.psu.edu/statprogram/node/138 propostscoreNTA <- subset(leow, subset=group=="NTA", select=c(propostscore)) #n=30 propostscoreTA <- subset(leow, subset=group=="ThinkAloud", select=c(propostscore)) #n=37 trimpb2 (propostscoreNTA, propostscoreTA, tr=.2, alpha=.05, nboot=2000, win=F, plotit=T) http://127.0.0.1:22644/library/WRS2/html/00Index.html