r での scheffe の多重比較

11
R でで Scheffe ででででで

Upload: reina

Post on 07-Feb-2016

259 views

Category:

Documents


0 download

DESCRIPTION

R での Scheffe の多重比較. Scheffe の多重比較を行うには?. 青木繁伸先生作成の関数 scheffe を利用する aov 関数でのデフォルトの対比を変更して分散分析を実行する.ただし,この方法は  Scheffe の方法と は異なる . 得られる t 値はほぼ同じ 参考: Crawley, M. J. 『 統計学: R を用いた入門書 』 (共立出版) 第12章.. データ. ボーンシュテット & ノーキ 『 社会統計学 』 表 7.1 のデータを用いる. 監視 の有無が課題遂行に及ぼす影響.1要因3水準のデザイン. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: R での Scheffe の多重比較

R での Scheffe の多重比較

Page 2: R での Scheffe の多重比較

Scheffe の多重比較を行うには?• 青木繁伸先生作成の関数 scheffeを利用する• aov 関数でのデフォルトの対比を変更して分散分析を実行する.ただし,この方法は  Scheffe の方法とは異なる.– 得られる t 値はほぼ同じ– 参考: Crawley, M. J. 『統計学: R を用いた入門書』(共立出版)第12章.

Page 3: R での Scheffe の多重比較

データ• ボーンシュテット & ノーキ『社会統計学』表 7.1 のデータを用いる.– 監視の有無が課題遂行に及ぼす影響.1要因3水準のデザイン.– 社会統計学の授業ウェブからデータを CSV で

ダウンロードできる.

Page 4: R での Scheffe の多重比較

> monitor <- read.csv("table7_1.csv")> head(monitor) score condition1 13 na2 14 na3 10 na4 11 na5 12 na6 10 na>

na :監視なしー隔離条件nt :監視なしー共作業条件m :監視条件

Page 5: R での Scheffe の多重比較

各条件の平均値と分散> tapply(monitor$score, monitor$condition, mean) m na nt 8.2 11.8 10.0 >

> tapply(monitor$score, monitor$condition, var) m na nt 2.622222 1.733333 1.333333 >

Page 6: R での Scheffe の多重比較

デフォルトの contrasts

> contrasts(monitor$condition) na ntm 0 0na 1 0nt 0 1

条件がアルファベット順に並ぶ

Page 7: R での Scheffe の多重比較

分析の実行> summary.lm(aov(monitor$score ~monitor$condition))

Call:aov(formula = monitor$score ~ monitor$condition)

Residuals: Min 1Q Median 3Q Max -2.200e+00 -9.500e-01 -2.801e-17 9.500e-01 2.800e+00

続きは次のスライド

Page 8: R での Scheffe の多重比較

分析の実行(つづき)Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 8.2000 0.4355 18.830 < 2e-16 ***monitor$conditionna 3.6000 0.6158 5.846 3.18e-06 ***monitor$conditionnt 1.8000 0.6158 2.923 0.00694 ** ---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.377 on 27 degrees of freedomMultiple R-squared: 0.5586, Adjusted R-squared: 0.5259 F-statistic: 17.09 on 2 and 27 DF, p-value: 1.603e-05

8.1 ;6.3 ;2.8 mntmnam yyyyy

Page 9: R での Scheffe の多重比較

対比の指定> contrasts(monitor$condition)         <- cbind(c(1,-1/2,-1/2),c(0,-1,1))> contrasts(monitor$condition) [,1] [,2]m 1.0 0na -0.5 -1nt -0.5 1>

各対比は直交(内積がゼロ).(1,-1,0) という対比は,すでに表現されている2つの対比から構成できるので,直交ではない.

Page 10: R での Scheffe の多重比較

分析の実行> summary.lm(aov(monitor$score ~ monitor$condition))

Call:aov(formula = monitor$score ~ monitor$condition)

Residuals: Min 1Q Median 3Q Max -2.200e+00 -9.500e-01 3.188e-17 9.500e-01 2.800e+00

続きは次のスライド

Page 11: R での Scheffe の多重比較

Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 10.0000 0.2514 39.775 < 2e-16 ***monitor$condition1 -1.8000 0.3556 -5.063 2.57e-05 ***monitor$condition2 -0.9000 0.3079 -2.923 0.00694 ** ---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.377 on 27 degrees of freedomMultiple R-squared: 0.5586, Adjusted R-squared: 0.5259 F-statistic: 17.09 on 2 and 27 DF, p-value: 1.603e-05

分析の実行(つづき)