For summarizing a data set use

En=: 4 : 0 NB. tombola-resume

y=.x*(+/%#)(,y)^/1+i.x
e=.1
for_i. 1+i.x do.
   e=.e,~i%~+/(_1^i.i)*e*i{.y
end.
_1&x:|.->{:p. e
)



The function 1&En is the mean value.
2&En is the mean value plus or minus the standard deviation.
3&En is 3 numbers summarizing the data set.
and so on.

 

   4 En a=.?100#0 NB. 100 numbers summarized by 4 numbers.

0.0689111 0.346506 0.508404 0.875302
   1 En a NB. 100 numbers summarized by 1 number.
0.449781
   1 En 0.0689111 0.346506 0.508404 0.875302 NB. 4 numbers summarized by 1 
number.
0.449781
   2 En a NB. 100 numbers summarized by 2 numbers.
0.158134 0.741428
   2 En 0.0689111 0.346506 0.508404 0.875302 NB. 4 numbers summarized by 2 
numbers.
0.158134 0.741428
  1 En 0.158134 0.741428 NB. 2 numbers summarized by 1 number.
0.449781


Thanks!
Bo.



    Den mandag den 22. februar 2021 02.59.07 CET skrev Raul Miller 
<[email protected]>:  
 
 It's perhaps worth noting that these do not always yield the same result:

  q2 5 7 11 13
6
  q3 5 7 11 13
4

FYI,

-- 
Raul

On Sun, Feb 21, 2021 at 6:10 PM xash <xash@λ.land> wrote:
>
> Without I.:
> q2=: (1r4 3r4 <.@* #) -/@:{ \:~
>
> And a fun one:
> q3=: \:~ -&({~ # <.@% 4:) /:~
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
  
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to