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

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

コマンド

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

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

#t&#26908;&#23450;&#12398;&#23455;&#26045;
#alternative: &#20001;&#20596;:"two.sided", &#24038;&#20596;:"less", &#21491;&#20596;:"greater"
#paired: &#23550;&#24540;&#12398;&#12354;&#12427;:"TRUE", &#23550;&#24540;&#12398;&#28961;&#12356;:"FALSE"
#var.equal: &#31561;&#20998;&#25955;&#12434;&#20206;&#23450;:"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 

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

Prices and shipping availability may change. Please refer to the product page at time of purchase.
Content displayed on this site is provided by Amazon and may be updated or removed.
Amazon Associate, karada-good earns income through qualifying sales.
タイトルとURLをコピーしました