Rで解析:t検定のコマンドを紹介

Rの解析に役に立つ記事

t検定はよく使われる手法だと思います。多重検定に使う場合はBonferroniの補正(繰り返し回数をp値に乗算するか、有意水準を割る。)を忘れずに。

スポンサーリンク
スポンサーリンク

コマンド

t.testのオプションはコメントを確認してください。

###データ例の準備#####
A <- sample(1:100, 20, replace = FALSE)
B <- sample(1:100, 20, replace = FALSE)

#t検定の実施
#alternative: 両側:"two.sided", 左側:"less", 右側:"greater"
#paired: 対応のある:"TRUE", 対応の無い:"FALSE"
#var.equal: 等分散を仮定:"TRUE"
t.test(A, B, alternative = "two.sided", paired = TRUE)


Paired t-test

data:  A and B
t = -0.2764, df = 19, p-value = 0.7852
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
  -21.85896  16.75896
sample estimates:
  mean of the differences 
-2.55 

少しでも、あなたの解析が楽になりますように!!

タイトルとURLをコピーしました