在R中,是否t.test(y1, y2, paired=T)暗示var.equal=T?
我问,因为这将帮助我弄清楚韦尔奇的t检验是否适合配对t检验.
当您使用x和运行配对测试时y,您实际上正在运行单样本测试d=x-y.这意味着只有一个变量d,因此只有一个样本可以得到方差.
所以谈论var.equal配对测试是没有意义的.
您可以看到所有这三个测试都会给出相同的结果.
> set.seed(0) # Sample data
> x <- rnorm(50, mean=10)
> y <- x+rnorm(50)
> t.test(x,y,paired=T,var.equal=T)
Paired t-test
data: x and y
t = -0.1766, df = 49, p-value = 0.8605
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2649616 0.2221498
sample estimates:
mean of the differences
-0.02140593
> t.test(x,y,paired=T,var.equal=F)
Paired t-test
data: x and y
t = -0.1766, df = 49, p-value = 0.8605
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2649616 0.2221498
sample estimates:
mean of the differences
-0.02140593
> t.test(x-y)
One Sample t-test
data: x - y
t = -0.1766, df = 49, p-value = 0.8605
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-0.2649616 0.2221498
sample estimates:
mean of x
-0.02140593
Run Code Online (Sandbox Code Playgroud)
您可以在Wikipedia上查看详细信息.在那里,您看到Welch仅用于未配对的样品.