quantile of a discrete random variable

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

quantile of a discrete random variable

L... L...
Dear all, is there a general method for calculating the quantile of a discrete random variable? If yes, is there a R function to do this?
Best regards
Marcelo Lamack


     
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: quantile of a discrete random variable

David Carlson
There is a function called quantile() that provides 9 methods of computing quantiles, three of which are appropriate for discontinuous data. Type

?quantile

at the command prompt for details.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:[hidden email]] On Behalf Of L... L...
Sent: Thursday, June 25, 2015 9:27 AM
To: [hidden email]
Subject: [R] quantile of a discrete random variable

Dear all, is there a general method for calculating the quantile of a discrete random variable? If yes, is there a R function to do this?
Best regards
Marcelo Lamack


     
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: quantile of a discrete random variable

David Winsemius
In reply to this post by L... L...

On Jun 25, 2015, at 7:26 AM, L... L... wrote:

> Dear all, is there a general method for calculating the quantile of a discrete random variable? If yes, is there a R function to do this?

The `quantile` function would seem to be the first place to go. It may depend on the object-type of your representation of the "random variable".

?quantile                 # to see the help page

The default of type=7 may not be what you want, but I suspect one of the other types would be appropriate. You could also cobble something together along the lines of:

 list(x= as.numeric(names(table(x))), y=cumsum(table(x))/sum(x) )

Could use the result of ecdf(and then reversing x and y for evaluation.).

>      
> [[alternative HTML version deleted]]
This is a plain text mailing list
>
> ______________________________________________
> [hidden email] 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.

David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] 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.