方差齐次性检验Comparing Variances in R

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

图片.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. 假设检验-方差齐性检验
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 文章作者:Tyan博客:noahsnail.com | CSDN | 简书 声明:作者翻译论文仅为学习,如有侵权请...
    SnailTyan阅读 2,531评论 0 5
  • 定义及分类 在进行 t 检验之前让我们先看看它的定义:t 检验法就是在假设检验时利用 t 分布进行概率计算的检验方...
    研究僧小蓝哥阅读 26,754评论 1 13
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,505评论 0 13
  • 好久没来简书了,真有点对不起我的这十几个粉丝,因为最近我都要抖音上活动,所以忘了这里,更忘了要拍过程图,所以...
    唐小妞的水彩阅读 229评论 0 3
  • 在生命历程中,平凡的一天,也是我余生中,最宝贵的一天,最美丽的一天。慵懒的睡个自然醒。八点多起床洗漱,喝水,吃...
    田辉_852a阅读 341评论 0 0