ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Median and quantile
    Computer/statistics with R 2009.03.11 20:13
    Reference : http://cran.r-project.org/doc/contrib/Verzani-SimpleR.pdf

    I try to summarize the median and quantile in my words according to the reference, but most of expressions are similar to the reference one.


    median


    If I have data, for example,
    1 3 9 29 37
    ,the median that divides data into upper and lower data points is 9.

    And if the data is
    1 3 9 29 37 48
    , the median is (9 + 29)/2.0 = 19 .

    quantile

    The quantile is an extended definition of the median. The p-quantile is a point which divides data into two parts: one is 100p% less than the point and the other is 100(1-p)% larger than it. And the p-quantile is called 100p%-percentile. Thus, the median is 0.5 quantile.

    quartile

    The 0.25 and 0.75 quantiles are called the quartiles. Thus, the first quartile Q1 is 0.25 quantile and the third quantile Q2 0.75 quantile. However we use not the second quartile but the median to describe 0.5 quantile.


    In CRAN, summary() function returns

    > sta = scan()
    1: 1 3 9 29 37
    6: 
    Read 5 items
    > summary(sta)
       Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
        1.0     3.0     9.0    15.8    29.0    37.0 
    > stb = c(sta,48)
    > summary(stb)
       Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
       1.00    4.50   19.00   21.17   35.00   48.00 
    

    'Computer > statistics with R' 카테고리의 다른 글

    Median and quantile  (0) 2009.03.11
    First R code  (0) 2007.08.02

    댓글 0

Designed by Tistory.