[R] Fwd: Summary vs fivenum results for Q3

roger koenker rkoenker at uiuc.edu
Tue Oct 9 18:18:47 CEST 2007


You can get anything you want, at Alice's Restaurant:

 > quantile(d,.75,type=1)
75%
913
 > quantile(d,.75,type=2)
   75%
981.5
 > quantile(d,.75,type=3)
75%
913
 > quantile(d,.75,type=4)
75%
913
 > quantile(d,.75,type=5)
   75%
981.5
 > quantile(d,.75,type=6)
     75%
1015.75
 > quantile(d,.75,type=7)
    75%
947.25
 > quantile(d,.75,type=8)
      75%
992.9167
 > quantile(d,.75,type=9)
      75%
990.0625


"correctly calculated"  has a sort of pre-post-modern flavor here...


url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker at uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820

>
> On Oct 9, 2007, at 10:20 AM, Schaefer, Robert L. Dr. wrote:
>
>> I've just started using R and am still a neophyte, but I found the  
>> following curious result.  I'm using the current version of R  
>> (2.5.1 (2007-06-27) ).
>>
>> Why are the results for the third quartile different in the output  
>> from the summary and fivenum commands?  For the following data set
>>
>> 457     514     530     530     538     560     687     745      
>> 745     778     786     790     792     821     821     822     822
>> 828     845     850     886     886     886     913     1050     
>> 1050    1065    1065    1065    1065    1090    1130
>>
>> Summary yields:
>>
>>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>   457.0   745.0   822.0   825.4   947.2  1130.0
>>
>> While fivenum yields:
>>
>> [1]  457.0  745.0  822.0  981.5 1130.0
>>
>> The third quartile is being correctly calculated in the fivenum  
>> command and incorrectly in the summary command.
>>
>> Bob
>>
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> Robert L. Schaefer, Professor of Statistics
>> Department of Mathematics and Statistics
>> Miami University
>> Oxford, Ohio 45056  (513) 529-3533 (513) 529-5818 (sec)
>> SchaefRL at MUOhio.Edu  HTTP://WWW.USERS.MUOHIO.EDU/SchaefRL
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting- 
>> guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list