[R] quantile of a discrete random variabel --- again

Bert Gunter bgunter.4567 at gmail.com
Thu Jun 25 19:27:54 CEST 2015


Well, presumably you have the pmf and can create a matrix of the form:
(where mypmf is your pmf)

x <- seq_len(1000) ## or whatever your discrete support sorted in
increasing order

## for individual quantile q:

max(x[cumsum(mypmf(x)) <= q] )

## This probably could be vectorized for a vector of quantiles . I
leave that to others both cleverer and more motivated than I.

Cheers,
Bert
Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Thu, Jun 25, 2015 at 8:59 AM, L... L... <mar.lamack at hotmail.com> wrote:
> I thank all for your reply. My question was not well formulated.
> I will do it again:
> Suppose that the random variable X is discrete with probability mass function (pmf) F (binomial, poisson, ....) not necessarily available in R.
> Is there a general method to get the quantiles (as qbinom, qpois, .....) or which is the method(s) used to get the quantiles (used in qbinom, qpois, .....)?
> Regards
> ML
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list