Doese anyone know a R function to find the median of a gamma distribution? [[alternative HTML version deleted]]
"Philip He" <hydinghua at gmail.com> writes:> Doese anyone know a R function to find the median of a gamma distribution?qgamma(0.5, ....) -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
On Fri, 30 Jun 2006, Philip He wrote:> Doese anyone know a R function to find the median of a gamma distribution? >It's not clear what you mean. If you know the parameters of a gamma distribution then qgamma() will give you any quantile. If you have data and want to estimate the median then it's hard to beat median(), but you could use mle() to estimate the parameters and then qgamma(). -thomas
>From: Philip He <hydinghua at gmail.com> >Date: Fri Jun 30 10:30:28 CDT 2006 >To: R help list <r-help at stat.math.ethz.ch> >Subject: [R] median of gamma distributionsomeone might know a more elegant way but one way is to use the distribution ( i think it's dnorm for the normal but i get confused because ther is also pnorm, rnorm and one other but you can look that up to figure out which one is the one you need ) functions in R and just put in .50 as the probabiliy input and itr will kick back the result which is the median. mark>Doese anyone know a R function to find the median of a gamma distribution? > > [[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
On 30-Jun-06 Philip He wrote:> Doese anyone know a R function to find the median of a gamma > distribution?qgamma will do it. Test:> -log(0.5)[1] 0.6931472> qgamma(0.5,1)[1] 0.6931472 Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 30-Jun-06 Time: 16:53:16 ------------------------------ XFMail ------------------------------
Hi, to compute the median (or expectation, var, sd, IQR, mad, ...) you can also use package "distrEx". library(distrEx) (G <- Gammad()) median(G) Matthias ----- original Nachricht -------- Betreff: Re: [R] median of gamma distribution Gesendet: Fri, 30. Jun 2006 Von: Ted.Harding at nessie.mcc.ac.uk> On 30-Jun-06 Philip He wrote: > > Doese anyone know a R function to find the median of a gamma > > distribution? > > qgamma will do it. Test: > > > -log(0.5) > [1] 0.6931472 > > qgamma(0.5,1) > [1] 0.6931472 > > Ted. > > > -------------------------------------------------------------------- > E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> > Fax-to-email: +44 (0)870 094 0861 > Date: 30-Jun-06 Time: 16:53:16 > ------------------------------ XFMail ------------------------------ > > ______________________________________________ > 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 >--- original Nachricht Ende ---- -- Dr. rer. nat. Matthias Kohl Matthias.Kohl at stamats.de www.stamats.de