bartlett检验_方差齐次性检验Comparing Variances in R

本文介绍了如何在R中进行方差齐次性检验,包括使用F检验比较两个总体的方差,以及Bartlett、Levene和Fligner-Killeen非参数检验来检测多个样本间的方差均等性。Bartlett检验适用于正态分布数据,而Levene和Fligner-Killeen检验则对非正态分布数据更具鲁棒性。
摘要由CSDN通过智能技术生成

在STHDA网站Comparing Variances in R 一文中,专门对正态性检验做了详致的说明,翻译并整理入下:

9b148fb43961d50efb0fc012a28ddcde.png

(一) F检验F-Test

F检验用于评估两个总体(A和B)的方差是否相等。
F-Test: Compare Two Variances in R.

> var.test(len ~ supp, data = my_data)

F test to compare two variances

data: len by supp
F = 0.6386, num df = 29, denom df = 29, p-value = 0.2331
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.3039488 1.3416857
sample estimates:
ratio of variances
0.6385951
(二) 比较方差的统计检验 Homogeneity of variances

有许多检验可以检测不同组之间方差的均等性(均一性),包括:

  • F-test: Compare the variances of two samples. The data must be normally distributed.

  • Bartlett’s test: Compare the variances of k samples, where k can be more than two samples. The data must be normally distributed. The Levene test is an alternative to the Bartlett test that is less sensitive to departures from normality.

  • Levene’s test: Compare the variances of k samples, where k can be more than two samples. It’s an alternative to the Bartlett’s test that is less sensitive to departures from normality.

  • Fligner-Killeen test: a non-parametric test which is very robust against departures from normality.

Bartlett’s test用于测试k个样本中方差的均匀性,其中k可以大于2。适用于正态分布的数据。当数据分布为非正态分布时,下一部分将描述的Levene检验是Bartlett检验的更稳健的替代方案。

2.1 Compute Bartlett’s test in R
# Bartlett’s test with one independent variable:
> bartlett.test(weight ~ group, data = PlantGrowth)

Bartlett test of homogeneity of variances

data: weight by group
Bartlett's K-squared = 2.8786, df = 2, p-value = 0.2371

# Bartlett’s test with multiple independent variables:
> bartlett.test(len ~ interaction(supp,dose), data=ToothGrowth)

Bartlett test of homogeneity of variances

data: len by interaction(supp, dose)
Bartlett's K-squared = 6.9273, df = 5, p-value = 0.2261
2.2 Compute Levene’s test in R
library(car)
> # Levene's test with one independent variable
> leveneTest(weight ~ group, data = PlantGrowth)
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 2 1.1192 0.3412
27
> # Levene's test with multiple independent variables
> leveneTest(len ~ supp*dose, data = ToothGrowth)
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 5 1.7086 0.1484
54
2.3 Compute Fligner-Killeen test in R
> fligner.test(weight ~ group, data = PlantGrowth)

Fligner-Killeen test of homogeneity of variances

data: weight by group
Fligner-Killeen:med chi-squared = 2.3499, df = 2, p-value = 0.3088

参考资料:

  1. Comparing Variances in R

  2. 假设检验-方差齐性检验

45c612eafb3177a0049201ae71d32807.png 我就知道你在看
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值