Hi All, I need to calculate the median for even number of data points.However instead of calculating the arithmetic mean of the two middle values,I need to calculate their geometric mean. Though I can code this in R, possibly in a few lines, but wondering if there is already some built in function. Can somebody give a hint? Thanks in advance [[alternative HTML version deleted]]
exp(median(log(x)) ? Hadley On Sat, Jan 15, 2011 at 10:26 AM, Skull Crossbones <witch.of.agnessi at gmail.com> wrote:> Hi All, > > I need to calculate the median for even number of data points.However > instead of calculating > the arithmetic mean of the two middle values,I need to calculate their > geometric mean. > > Though I can code this in R, possibly in a few lines, but wondering if there > is > already some built in function. > > Can somebody give a hint? > > Thanks in advance > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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. >-- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
Will this do? x <- runif(20, 1, 100) exp( median( log( x) ) ) S Ellison>>> Skull Crossbones <witch.of.agnessi at gmail.com> 15/01/2011 16:26 >>>Hi All, I need to calculate the median for even number of data points.However instead of calculating the arithmetic mean of the two middle values,I need to calculate their geometric mean. Though I can code this in R, possibly in a few lines, but wondering if there is already some built in function. Can somebody give a hint? Thanks in advance [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list 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. ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}