Weltchのt検定は,独立2群のt検定が拡張された手法です.Weltchのt検定では等分散を仮定せず,比較する母集団の母分散σ^2(もしくは,母標準偏差σ)が等くても(σA=σB),等くなくても(σA≠σB)どちらの状況にも対応します.Weltchのt検定の過程は比較する2つの母集団が正規分布に従うことだけを前提としています.
前回同様に,データ(example_a.csv)を読み込みます.
> ex.a <- read.csv("example.a.csv")
> str(ex.a)
'data.frame': 10 obs. of 2 variables:
$ choles: int 118 132 120 115 113 129 126 134 135 131
$ suppl : chr "A" "A" "A" "A" ...
> ex.a $ suppl <- factor(ex.a $suppl)
> str(ex.a)
'data.frame': 10 obs. of 2 variables:
$ choles: int 118 132 120 115 113 129 126 134 135 131
$ suppl : Factor w/ 2 levels "A","B": 1 1 1 1 1 2 2 2 2 2
> t.test(A ~ B)
> t.test(choles ~ suppl)
Welch Two Sample t-test
data: choles by suppl
t = -3.0732, df = 5.8431, p-value = 0.02261
alternative hypothesis: true difference in means between group A and group B is not equal to 0
95 percent confidence interval:
-20.536084 -2.263916
sample estimates:
mean in group A mean in group B
119.6 131.0
0 件のコメント :
コメントを投稿