[On Chris' suggestion this thread was moved here from "Chat" forum as
there are programming topics involved ...]
Hm, this debate about the term "common mean" seems to be 1.5 decades old ...
I'm directing this post especially (but not exclusively) to
- Chris Burke and
- Ric Sherlock
as from looking at the "trunk" it seems that these gentlemen have
been the sole maintainers of the '/addons/stats/base/univariate.ijs' script.
(Thanks Martin Neitzel for showing me the way.)
Additional problem however is that the term in question is used in
various other places and discussions on the site.
-----
After I did some more reading on the subject (calculating different
means) may I suggest this:
[1]
In this context, drop the name "common mean" altogether.
It is used for other stuff (in descriptive statistics e.g. when
comparing separate datasets).
[2]
Use "agm" instead.
This is what is meant (limit of two convergent sequences), and seems
to be the accepted abbreviation, see e.g.
http://mathworld.wolfram.com/Arithmetic-GeometricMean.html
(Gauss is said to have coined agM, short for
'arithmetisch-geometrisches Mittel'.
AGM is used to evaluate Elliptic Integrals, which in turn may be used
to calculate e.g. the perimeter of an ellipse.
The AGM approach has also been used to formulate fast convergent
algorithms to calculate Pi.)
NB. This should take _two_ arguments as input;
NB. it will show strange results when used on more than two arguments
agm=: [: {. (%:@*/ , -:@+/) ^: _
or (maybe better)
NB. restrained
agm=: 3 : '{: (-:@+/,%:@*/)^:_ a,b [''a b''=. y'
NB. seems alright (twice same argument)
agm 1
1
NB. intended use (two arguments)
agm 1,%%:2
0.847213
NB. failing with error message
agm 1,2,3
|length error: agm
| {:(-:@+/,%:@*/)^:_ a,b['a b' =.y
[3]
Use "agmx" or "cmean" or "cm" (short for Compound Mean = extended
AGM) when there are more than two values in the argument list.
With
NB. arithmetic mean
amean=: +/ % #
NB. geometric mean
gmean=: amean &.: ^.
agmx=: [: {: (amean,gmean) ^:_
-----
Please let me know of
- your thoughts regarding the proposed changes;
- ways to improve on the verbs mentioned.
Thanks
-M
At 2016-08-04 20:31, you wrote:
Entering "with the *exact phrase" "*common mean" on the following link
http://www.jsoftware.com/forumsearch
produced 20 messages:
http://www.jsoftware.com/cgi-bin/forumsearch.cgi?all=&exa=common+mean&one=&exc=&add=&sub=&fid=&tim=0&rng=0&dbgn=1&mbgn=1&ybgn=1998&dend=31&mend=12¥d=2016
On Thu, Aug 4, 2016 at 12:04 PM, Martin Kreuzer <[email protected]> wrote:
> Hi all -
> Working my way through "/addons/stats/base/univariate.ijs" I covered the
> basics up to (var) and (stddev).
> Q:
> Could somebody point me to a worked example illustrating the use of
> (commonmean)..?
> commonmean=: [: {. (%:@*/ , -:@+/) ^: _
> (This is not so much about the programming but about the general concept
> of that term, as I'm only so far aware of 'common arithmetic mean'. That's
> the reason I put it here in Chat.)
> Thanks.
> -M
--
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm