gpt4 book ai didi

r - t.test(y1, y2,paired=T) 是否意味着 var.equal=T?

转载 作者:行者123 更新时间:2023-12-02 21:29:20 26 4
gpt4 key购买 nike

在 R 中,t.test(y1, y2,paired=T) 是否意味着 var.equal=T

我问这个问题是因为这将帮助我弄清楚韦尔奇的 t 检验是否适合配对 t 检验。

最佳答案

当您使用 xy 运行配对测试时,您实际上是在对 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

您可以在 Wikipedia 上查看详细信息。您可以看到 Welch 仅用于未配对的样本。

关于r - t.test(y1, y2,paired=T) 是否意味着 var.equal=T?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22719701/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com