[Jprogramming] Stats example ...
'Bo Jacoby' via Programming
programming at jsoftware.com
Mon Jun 13 18:55:27 UTC 2016
E+/ % # E 5 2 6 75 (-E) 5 2 6 70 _3 1 2 *:(-E) 5 2 6 70 9 1 4 E*:(-E) 5 2 6 73.5 E&.:*:(-E) 5 2 6 71.87083
Den 18:33 mandag den 13. juni 2016 skrev Martin Kreuzer <info at airkreuzer.com>:
Hi all -
While browsing the J NuVoc page I accidentally stumbled upon this example:
URL: http://code.jsoftware.com/wiki/Vocabulary/ampdotco
Under "Common Uses / 2. Compute standard deviation as the
root-mean-square of a list of differences from the mean value"
the example starts out with
y =: 0 _2 1 2 NB. list of differences from the mean value
This didn't look right to me as the sum of deviations does not result in zero:
+/ 0 _2 1 2
1
So I made up an example myself:
obs=. 5 2 6 7 NB. observed data
amean=. +/ % # NB. arithmetic mean
dev=. ] - amean NB. deviation from mean value
dev obs
0 _3 1 2
Comparing this result with the above (original set of deviations)
makes me think it might be a typo.
The "mean deviation" (mean of absolute deviation values) would then be
dmean=. amean @: |
dmean dev obs
1.5
and the standard deviation (root-mean-square of deviation values)
stddev=. amean &.: *:
stddev dev obs
1.87083
Would somebody please have a look into that to check whether I'm
utterly wrong or not..?
Thanks
-M
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list