data.ex=read.csv("Table812.csv",header=T)
data.ex
#関数 aov(従属変数~独立変数,データ)
aov.ex=aov(score~cond,data.ex)
#結果の要約
summary(aov.ex)
#効果量を求める(1)分散分析表のSS を使う p.235参照
eta2 <- 261.7/(261.7+110.0)
eta2
#多重比較 テューキー法
TukeyHSD(aov.ex,"cond" , ordered = TRUE)
# Bonferroniの方法による多重比較の場合
attach(data.ex)
pairwise.t.test(score, cond, p.adj = "bonf")
# Holmの方法による多重比較の場合
pairwise.t.test(score, cond, p.adj = "holm")
#結果の図示 まず平均値などを計算
attach(data.ex)
tapply(score,cond,mean)
tapply(score,cond,sd)
#上の結果を使う
x <- c(27.6,32.0,37.8)
names(x) <- c("A","B","C")
barplot(x, xlab = "Treatment", ylab = "MAS score")
#以下は参考、応用
#参考)エラーバーをつけるならば
se <- c(3.049590/sqrt(5), 2.915476/sqrt(5), 3.114482/sqrt(5))
b <- barplot(x, xlab = "Treatment", ylab = "MAS score",ylim = c(0, max(x + se)))
arrows(b, x - se, b, x + se, code = 3, lwd = 1, angle = 90, length = 0.1)
# 参考)効果量とその信頼区間を求める(2)
#以下のサイトで偏イータ二乗とその信頼区間を求めることができます
# https://effect-size-calculator.herokuapp.com/
# 以下のサイト「ANOVA君」 を使う方法もあります
# https://riseki.cloudfree.jp/?ANOVA%E5%90%9B
#出力例 一部のみ
> anovakun(data.ex, "As",3, holm = T,eta=T,cilmd = T,nesci = T)
[ As-Type Design ]
<< ANOVA TABLE >>
-------------------------------------------------------------
Source SS df MS F-ratio p-value eta^2
-------------------------------------------------------------
A 261.7333 2 130.8667 14.2764 0.0007 *** 0.7041
Error 110.0000 12 9.1667
-------------------------------------------------------------
Total 371.7333 14 26.5524
+p < .10, *p < .05, **p < .01, ***p < .001
<< EFFECT SIZE INFORMATION >>
=== Noncentral F Distribution-Based Confidence Intervals for Effect Sizes ===
=== 95% confidence intervals are calculated. ===
------------------------------------------------------------
ES Source Estimate CI_L CI_U ncp_L ncp_U
------------------------------------------------------------
eta^2 A 0.7041 0.2500 0.8142 4.9987 65.7275
------------------------------------------------------------