[R] Calculating Percentile in R

From: Megh Dal <megh700004_at_yahoo.com>
Date: Sun, 17 Jun 2007 23:37:10 -0700 (PDT)


Hi all,  

I have a problem on how R calculates Percentiles :  

Suppose I have following data set:
> data1

  [1] -16648185 -14463457 -14449400 -13905309 -13443436 -13234755 -12956282 -11660896
  [9] -10061040  -9805005  -9789583  -9754642  -9562164  -9391709  -9212182  -9151073

[17] -9092732 -9068214 -8978151 -8943912 -8761890 -8632106 -8541580 -8501249
[25] -8234466 -8219015 -8193543 -7488279 -7340768 -7236684 -7225458 -7159465
[33] -6819625 -6810858 -6755620 -6626439 -6610901 -6551762 -6207377 -6192583
[41] -6106783 -6077051 -6035300 -6035195 -6019017 -5954375 -5946285 -5886082
[49] -5880402 -5723368 -5668698 -5599168 -5548276 -5445734 -5412312 -5384707
[57] -5309365 -5303425 -5285274 -5204585 -5096301 -5092182 -5053349 -5041533
[65] -5021234 -5005402 -4984232 -4981990 -4964457 -4936653 -4920384 -4918021
[73] -4895351 -4843258 -4824730 -4774792 -4771018 -4616156 -4590430 -4444262
[81] -4443954 -4435397 -4415112 -4374465 -4341858 -4267891 -4252410 -4185021
[89] -4164458 -4158863 -4020436 -4006030 -3975819 -3959667 -3916414 -3876878
[97] -3765340 -3729338 -3713670 -3634991

Now the 5th percentile should be value corresponding to 0.05*(100+1) = 5.05 = 5 (rounded)  

hence : -13443436  

But R give the value :
> quantile(data1, 0.05)

       5%
-13245189  

Can anyone clarify me on this regards?  

Thanks
Megh
       


Comedy with an Edge to see what's on, when.

        [[alternative HTML version deleted]]



R-help_at_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 and provide commented, minimal, self-contained, reproducible code. Received on Mon 18 Jun 2007 - 06:45:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Jun 2007 - 08:32:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.