四分位差,即IQR,在统计学中是一个用来辅助数据列的结论的单位。这个数据比数据范围(range)要更好用点,因为在数据分布中,四分位差可以排除掉大多数异常值的影响。下面我们来讲讲怎么得出四分位差。
步骤
-
{"smallUrl":"https:\/\/www.zenmeban.com\/images_en\/thumb\/9\/90\/Find-the-IQR-Step-1.jpg\/v4-460px-Find-the-IQR-Step-1.jpg","bigUrl":"https:\/\/www.zenmeban.com\/images\/thumb\/9\/90\/Find-the-IQR-Step-1.jpg\/v4-728px-Find-the-IQR-Step-1.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><\/div>"}
1
理解四分位差的用处。四分位差的定义是上四分位数和下四分位数的差值,一般写作Q3 - Q1。
-
{"smallUrl":"https:\/\/www.zenmeban.com\/images_en\/thumb\/d\/d6\/Find-the-IQR-Step-2.jpg\/v4-460px-Find-the-IQR-Step-2.jpg","bigUrl":"https:\/\/www.zenmeban.com\/images\/thumb\/d\/d6\/Find-the-IQR-Step-2.jpg\/v4-728px-Find-the-IQR-Step-2.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><\/div>"}
2
按递增顺序排列数据。
- 偶数例子: 4 7 9 11 12 20
- 奇数例子: 5 8 10 10 15 18 23
-
{"smallUrl":"https:\/\/www.zenmeban.com\/images_en\/thumb\/0\/07\/Find-the-IQR-Step-3.jpg\/v4-460px-Find-the-IQR-Step-3.jpg","bigUrl":"https:\/\/www.zenmeban.com\/images\/thumb\/0\/07\/Find-the-IQR-Step-3.jpg\/v4-728px-Find-the-IQR-Step-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><\/div>"}
3
找出数据的中间点。
- 偶数例子: 4 7 9 | 11 12 20
- 奇数例子: 5 8 10 (10) 15 18 23
-
{"smallUrl":"https:\/\/www.zenmeban.com\/images_en\/thumb\/4\/44\/Find-the-IQR-Step-4.jpg\/v4-460px-Find-the-IQR-Step-4.jpg","bigUrl":"https:\/\/www.zenmeban.com\/images\/thumb\/4\/44\/Find-the-IQR-Step-4.jpg\/v4-728px-Find-the-IQR-Step-4.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><\/div>"}
4
找出上半部和下半部的中位数,如果你的数据个数为奇数,就排除中间一位。
- 偶数例子:
- 下半部中位数= 7 (Q1)
- 上半部中位数= 12 (Q3)
- 奇数例子:
- 下半部中位数= 8 (Q1)
- 上半部中位数=18 (Q3)
-
{"smallUrl":"https:\/\/www.zenmeban.com\/images_en\/thumb\/b\/b1\/Find-the-IQR-Step-5.jpg\/v4-460px-Find-the-IQR-Step-5.jpg","bigUrl":"https:\/\/www.zenmeban.com\/images\/thumb\/b\/b1\/Find-the-IQR-Step-5.jpg\/v4-728px-Find-the-IQR-Step-5.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><\/div>"}
5
把Q3 - Q1,得到四分位差。
- 偶数例子: 12 - 7 = 5
- 奇数例子: 18 - 8 = 10