User Tools

Site Tools


quartile

This is an old revision of the document!


Quartile

Symbol Names Definition
Q1 first quartile
lower quartile
25th percentile
splits off the lowest 25% of data from the highest 75%
일사분위수 (하한사분위수)
Q2 second quartile
median
50th percentile
cuts data set in half
(중앙값)
Q3 third quartile
upper quartile
75th percentile
splits off the highest 25% of data from the lowest 75%
삼사분위수 (상한사분위수)

interquartile and outliers

사분범위 = Q3 - Q1
사분범위 = (상한사분위수) - (하한사분위수)

Finding lower and upper quartile

e.g. 1

> k <- c(1:8)
> 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 
> 
{1, 2, 3, 4, 5, 6, 7, 8}

head first

  • 하한
    • n / 4 = ?
    • 정수이면? 그 위치값과 다음 위치 값의 사이값
    • 정수가 아니면? 올림을 한 위치의 값
  • 상한
    • 3n / 4 = ?
    • 정수이면? 그 위치 값과 그 다음에 위치 값의 사이값
    • 정수가 아니면? 올림을 한 위치 값

위의 방법으로는
lower quartile: 2
upper quartile: 6

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

e.g. 2

r uses a different method. See the next e.g. 2.
https://stats.stackexchange.com/questions/134229/finding-quartiles-in-r

in r

> j <- c(6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49)
> quantile(j)
  0%  25%  50%  75% 100% 
 6.0 25.5 40.0 42.5 49.0 

Method r

  • 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.
jh1 <- c(6, 7, 15, 36, 39, 40)
(15+36)/2 
jh2 <- c(40, 41, 42, 43, 47, 49)
(42+43)/2
  • 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 “Tukey's hinges.”

???

> k <- c(6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49, 50)
> ks <- sort(k)
> ks
 [1]  6  7 15 36 39 40 41 42 43 47 49 50
> length(ks)
[1] 12
> quantile(ks)
   0%   25%   50%   75%  100% 
 6.00 30.75 40.50 44.00 50.00 
> 

in r

> duration = faithful$eruptions     # the eruption duration
> quantile(duration)                # apply the quantile function 
    0%    25%    50%    75%   100% 
1.6000 2.1627 4.0000 4.4543 5.1000

quantile, not qurtile

quartile.1569205246.txt.gz · Last modified: 2019/09/23 11:20 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki