[R] different types in quantile{stats}

From: Anna Kreshuk <anna.krechtchouk_at_cern.ch>
Date: Fri 28 Oct 2005 - 20:50:43 EST


Dear R-users,

I've been comparing different types used in quantile() function and I found a thing I don't understand.
When n*p[i] is less than 1, most types return the smallest vector element, while type 7 interpolates between the smallest and the second smallest element. Other types, that generally also use linear interpolation, don't do it.
Example:
> inp

 [1] -0.762498 0.785960 1.588090 1.059290 0.022041 0.423641 0.992247  [8] -0.240316 -0.231395 0.762765 -1.474740
> quantile(inp, p, type=6)

     0.1% 0.5% 1% 2% 5% 10% 50% -1.474740 -1.474740 -1.474740 -1.474740 -1.474740 -1.332292 0.423641
> quantile(inp, p, type=7)

     0.1% 0.5% 1% 2% 5% 10% 50% -1.467618 -1.439128 -1.403516 -1.332292 -1.118619 -0.762498 0.423641
> quantile(inp, p, type=8)

     0.1% 0.5% 1% 2% 5% 10% 50% -1.474740 -1.474740 -1.474740 -1.474740 -1.474740 -1.142360 0.423641

Is there an explanation to it? I couldn't find anything in the function description.

Thanks in advance,
Anna



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Oct 28 20:55:46 2005

This archive was generated by hypermail 2.1.8 : Fri 28 Oct 2005 - 21:15:34 EST