Bug 14383 - inconsistent results from quantile type = 6
inconsistent results from quantile type = 6
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Accuracy
R 2.11.1
ix86 (32-bit) Linux-Debian
: P5 normal
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-22 06:57 UTC by Joshua Wiley
Modified: 2010-09-22 08:25 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Wiley 2010-09-22 06:57:36 UTC
Here is the code:

set.seed(1)
x <- rnorm(100)
quantile(x, type = 6, probs = c(0, .5))
quantile(x, type = 6, probs = c(.5, 0))

and my results from:
> sessionInfo()
R version 2.11.1 (2010-05-31) 
i486-pc-linux-gnu 

> set.seed(1)
> x <- rnorm(100)
> quantile(x, type = 6, probs = c(0, .5))
         0%         50% 
-2.21469989  0.07456498 
> quantile(x, type = 6, probs = c(.5, 0))
       50%         0% 
 0.1139092 -2.2146999 

The 50th percentile is quite different.  I believe this may be fixed by changing line 65 of quantile.default from:

other <- (h > 0) && (h < 1)

to:

other <- (h > 0) & (h < 1)
Comment 1 Brian Ripley 2010-09-22 08:25:56 UTC
fixed for 2.12.0