quartile
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| quartile [2019/09/24 10:29] – [e.g. 1] hkimscil | quartile [2023/09/11 08:42] (current) – [r method] hkimscil | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| ====== Finding lower and upper quartile ====== | ====== Finding lower and upper quartile ====== | ||
| ===== e.g. 1, Head First method ===== | ===== e.g. 1, Head First method ===== | ||
| - | |||
| < | < | ||
| > k | > k | ||
| Line 34: | Line 33: | ||
| 위의 방법으로는 | 위의 방법으로는 | ||
| - | lower quartile: 2 | + | lower quartile: 2.5 |
| - | upper quartile: 6 | + | upper quartile: 6.5 |
| Ordered Data Set: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49 | Ordered Data Set: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49 | ||
| Line 45: | Line 44: | ||
| - | ===== e.g. 2 ===== | + | ===== r method |
| - | + | ||
| - | r uses a different method. See the next e.g. 2. | + | |
| - | https:// | + | |
| - | + | ||
| in r | in r | ||
| - | < | + | < |
| + | j <- c(1,2,3,4,5) | ||
| + | j <- sort(j) | ||
| + | quantile(j) | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | > j <- c(1,2,3,4,5) | ||
| + | > j <- sort(j) | ||
| > quantile(j) | > quantile(j) | ||
| 0% 25% 50% 75% 100% | 0% 25% 50% 75% 100% | ||
| - | 6.0 25.5 40.0 42.5 49.0 </ | + | |
| - | + | > | |
| - | Method r | + | </ |
| + | 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. |
| + | |||
| < | < | ||
| - | jh1 <- c(6, 7, 15, 36, 39, 40) | + | j2 <- c(1,2,3,4,5,6) |
| - | (15+36)/2 | + | j2 <- sort(j2) |
| - | jh2 <- c(40, 41, 42, 43, 47, 49) | + | quantile(j2) |
| - | (42+43)/2 | + | </code> |
| + | < | ||
| + | > j2 <- c(1,2,3,4,5,6) | ||
| + | > j2 <- sort(j2) | ||
| + | > quantile(j2) | ||
| + | 0% 25% 50% 75% 100% | ||
| + | 1.00 2.25 3.50 4.75 6.00 | ||
| + | > | ||
| + | > | ||
| </ | </ | ||
| - | | + | Even number of elements |
| - | * 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 " | + | * lower bound (lower quartile) 앞부분을 반으로 쪼갯을 때의 숫자 (여기서는 2) 더하기, 그 다음숫자와의 차이의 (3-2) 1/4지점 (여기서는 2 + 0.25 = 2.25) 구한다. |
| + | * upper bound는 뒷부분의 반인 5에서 한칸 아래의 숫자인 4 더하기, 그 다음 숫자와의 차이의 (5와 4의 차이인 1) 3/4 지점을 (여기서는 4 + 0.75 = 4.75) 구한다. | ||
| - | ??? | ||
| < | < | ||
| - | > k <- c(6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49, 50) | + | > j3 <- c(7, 18, 5, 9, 12, 15) |
| - | > ks <- sort(k) | + | > j3s <- sort(j3) |
| - | > ks | + | > j3s |
| - | | + | [1] |
| - | > length(ks) | + | > quantile(j3s) |
| - | [1] 12 | + | |
| - | > quantile(ks) | + | |
| | | ||
| - | 6.00 30.75 40.50 44.00 50.00 | + | 5.00 7.50 10.50 14.25 18.00 |
| > | > | ||
| </ | </ | ||
| + | median = (9+12)/2 | ||
| + | the 1st quartile = 7 + (9-7)*(1/4) = 7 + 0.5 = 7.5 | ||
| + | the 3rd quartile = 12 + (12-9)*(3/ | ||
| ---- | ---- | ||
quartile.1569288553.txt.gz · Last modified: by hkimscil
