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]]
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:r-help-bounces at r-project.org] On Behalf Of L... L... Sent: Thursday, June 25, 2015 9:27 AM To: r-help at r-project.org 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]] ______________________________________________ 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.
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> > ______________________________________________ > 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.David Winsemius Alameda, CA, USA