quartile
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| quartile [2019/09/16 11:46] – hkimscil | quartile [2023/09/11 08:42] (current) – [r method] hkimscil | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| 사분범위 = (상한사분위수) - (하한사분위수) | 사분범위 = (상한사분위수) - (하한사분위수) | ||
| - | ---- | ||
| ====== Finding lower and upper quartile ====== | ====== Finding lower and upper quartile ====== | ||
| - | ===== head first ===== | + | ===== e.g. 1, Head First method |
| + | < | ||
| + | > k | ||
| + | [1] 1 2 3 4 5 6 7 8 | ||
| + | > quantile(k) | ||
| + | 0% 25% 50% 75% 100% | ||
| + | 1.00 2.75 4.50 6.25 8.00 | ||
| + | > </ | ||
| + | |||
| + | < | ||
| + | head first | ||
| * 하한 | * 하한 | ||
| * n / 4 = ? | * n / 4 = ? | ||
| Line 23: | Line 32: | ||
| * 정수가 아니면? 올림을 한 위치 값 | * 정수가 아니면? 올림을 한 위치 값 | ||
| - | < | + | 위의 방법으로는 |
| - | > k | + | |
| - | [1] 1 2 3 4 5 6 7 8 | + | |
| - | > quantile(k) | + | |
| - | 0% 25% 50% 75% 100% | + | |
| - | 1.00 2.75 4.50 6.25 8.00 | + | |
| - | > </ | + | |
| - | 그러나, | + | |
| lower quartile: 2.5 | lower quartile: 2.5 | ||
| upper quartile: 6.5 | upper quartile: 6.5 | ||
| + | Ordered Data Set: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49 | ||
| + | * 11 / 4 = 2.75 -> 3 | ||
| + | * lower quartile: 15 | ||
| + | * 33 / 4 = 8.25 -> 9 | ||
| + | * upper: 43 | ||
| - | ===== Method 1 ===== | ||
| - | * Use the median to divide the ordered data set into two halves. | ||
| - | * If there is an odd number of data points in the original ordered data set, do not include the median (the central value in the ordered list) in either half. | ||
| - | * If there is an even number of data points in the original ordered data set, split this data set exactly in half. | ||
| - | * The lower quartile value is the median of the lower half of the data. The upper quartile value is the median of the upper half of the data. | ||
| - | * This rule is employed by the TI-83 calculator boxplot and "1-Var Stats" functions. | ||
| - | ===== Method 2 ===== | + | ===== r method |
| + | in r | ||
| + | < | ||
| + | j <- c(1, | ||
| + | j <- sort(j) | ||
| + | quantile(j) | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | > j <- c(1, | ||
| + | > j <- sort(j) | ||
| + | > quantile(j) | ||
| + | 0% 25% 50% 75% 100% | ||
| + | | ||
| + | > | ||
| + | </ | ||
| + | Odd number of elements | ||
| * Use the median to divide the ordered data set into two halves. | * Use the median to divide the ordered data set into two halves. | ||
| - | * If there are an odd number of data points in the original ordered data set, include the median (the central value in the ordered list) in both halves. | + | * If there are an odd number of data points in the original ordered data set, include the median (the central value in the ordered list) in both halves. |
| - | * If there are an even number of data points in the original ordered data set, split this data set exactly in half. | + | |
| - | * The lower quartile value is the median of the lower half of the data. The upper quartile value is the median of the upper half of the data. | + | |
| - | * The values found by this method are also known as " | + | |
| - | Ordered Data Set: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49 | ||
| - | | | method | + | < |
| - | | Q1 | 15 | 25.5 | | + | j2 <- c(1, |
| - | | Q2 | 40 | 40 | | + | j2 <- sort(j2) |
| - | | Q3 | 43 | 42.5 | | + | quantile(j2) |
| + | </ | ||
| + | < | ||
| + | > j2 <- c(1, | ||
| + | > j2 <- sort(j2) | ||
| + | > quantile(j2) | ||
| + | 0% 25% 50% 75% 100% | ||
| + | 1.00 2.25 3.50 4.75 6.00 | ||
| + | > | ||
| + | > | ||
| + | </ | ||
| + | |||
| + | Even number of elements | ||
| + | * If there are an even number of data points in the original ordered data set, split this data set exactly in half. 즉, 3과 4의 가운데 값 (50%) = 3.5 | ||
| + | | ||
| + | * upper bound는 뒷부분의 반인 | ||
| + | |||
| + | < | ||
| + | > j3 <- c(7, 18, 5, 9, 12, 15) | ||
| + | > j3s <- sort(j3) | ||
| + | > j3s | ||
| + | [1] 5 7 9 12 15 18 | ||
| + | > quantile(j3s) | ||
| + | | ||
| + | | ||
| + | > | ||
| + | </ | ||
| + | median = (9+12)/2 | ||
| + | the 1st quartile = 7 + (9-7)*(1/4) = 7 + 0.5 = 7.5 | ||
| + | the 3rd quartile = 12 + (12-9)*(3/ | ||
| - | in r | ||
| - | < | ||
| - | > k | ||
| - | [1] 1 2 3 4 5 6 7 8 | ||
| - | > quantile(k) | ||
| - | 0% 25% 50% 75% 100% | ||
| - | 1.00 2.75 4.50 6.25 8.00 | ||
| - | > </ | ||
| ---- | ---- | ||
| in r | in r | ||
quartile.1568602011.txt.gz · Last modified: by hkimscil
