Hi all:
require'stats'
]u=:?.3 4 5$10
6 5 9 2 4
9 0 7 0 4
6 8 3 8 1
2 8 0 0 2
1 6 0 4 4
1 3 3 6 6
5 7 8 8 2
1 9 7 9 9
1 4 3 9 7
2 4 3 7 5
3 8 3 6 5
7 7 5 6 3
mean"3 u
2.66667 5 4 5 5
4 2.33333 4.33333 4.33333 5
4.66667 7.66667 4.66667 7.33333 2.66667
3.33333 8 4 5 4.66667
This is OK.
median"3 u
1 6 0 4 4
1 3 3 6 6
5 7 8 8 2
1 9 7 9 9
In this case I would like to have the median value, median of the
corresponding 3 (i,j) values. That is, (z=:median"3 u) should be
median of (6, 1, 1), (5, 6, 4), ... and so on. However, the result
is just 1{u. This is not my desire.
How do I get the following matrix?
/ median(6,1,1),median(5,6,4),...,median(4,4,7)\ /1 5 ...4\
| median(9,1,2),median(0,3,4),...,median(4,6,5)| |2 3 ...5|
| ... |= |... |
\ median(2,1,7),median(8,9,7),...,median(2,9,3)/ \2 8 ...3/
Best regards.
Toshinari Kamakura
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm