Geometric Mean: is there a built-in?

Posted by doug on Stack Overflow See other posts from Stack Overflow or by doug
Published on 2010-04-08T18:49:53Z Indexed on 2010/04/08 18:53 UTC
Read the original article Hit count: 154

Filed under:
|

i tried to find a built-in for geometric mean but couldn't.

(Obviously a built-in isn't going to save me any time while working in the shell, nor do i suspect there's any difference in accuracy; for scripts i try to use built-ins as often as possible, where the (cumulative) performance gain is often noticeable.

In case there isn't one (which i doubt is the case) here's mine.

gm_mean = function(a){prod(a)^(1/length(a))}

© Stack Overflow or respective owner

Related posts about r

    Related posts about statistics