1

I want to compute cumulative proportions of samples.

R> x=c(92, 3, 1, 4, 15, 4)
R> ecdf(x)(x)
[1] 1.0000000 0.3333333 0.1666667 0.6666667 0.8333333 0.6666667

The above is a way to compute cumulative proportions as shown in the first figure. I think it is for type 7 as the default type of quantile() is of type 7.

https://blogs.sas.com/content/iml/2017/05/24/definitions-sample-quantiles.html

But I don't find an easy way to compute cumulative proportions for other types. Is thre a function in R to compute cumulative proportions from samples of all the 9 types?

halfer
  • 19,824
  • 17
  • 99
  • 186
user1424739
  • 11,937
  • 17
  • 63
  • 152
  • If you just type in ecdf in the console of Rstudio, you can see that ecdf is not using any quantile function but something based on `cumsum(tabulate(match(x, vals)))/n`. If you want to use the quantile-function, you could take the ecdf function as an example and modify this part integrating the quantile function with type=x. – JKupzig Jan 21 '22 at 14:45
  • Thanks for the feedback. Can anybody provide a solution to the question? – user1424739 Jan 22 '22 at 01:30

0 Answers0