Skip to content

Quartiles and Inter-Quartile Range

7 messages · Girish A.R., David Freedman, eeramalho +1 more

#
Why am I getting a wrong result for quartiles?

here is my code:
The result R gives me is:

For the summary
910    1048    1088    1104    1139    1415 

For IQR
*********

The true Q1 is 1039 and not 1048. Q2 is 1156.5 and not 1139. And the
Inter-Quartile Range is 117.5 and not 91.25

How can I get these number right?
#
Interestingly, Hmisc::describe() and summary() seem to be using one Type, and
stats::fivenum() seems to be using another Type.
[1]  910.0 1039.0 1088.5 1156.5 1415.0
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    910    1048    1088    1104    1139    1415
n  missing   unique     Mean      .05      .10      .25      .50     
.75 
    "12"      "0"     "12"   "1104" " 920.5" " 938.3" "1047.5" "1088.5"
"1138.8" 
     .90      .95 
"1248.7" "1327.0" 

cheers,
-Girish
2 days later
#
eeramalho wrote:
There are two possibilities:
1. you need to use the argument 'datax = TRUE'
2. SAS is wrong

You might also have a look at the qq.plot() function
in package 'car'.

  -Peter Ehlers