My twopenn'th, while we're home, briefly...

It seemed best to prepend throwaway extra values to ensure the

appropriate assignment of wins and losses. The Kelly method

doesn't consider the cases of zero wins and/or losses!


kf =: 3 : 0  NB. quite similar to Devon's versions
returns       =. y
mean          =. +/%#
'wins losses' =. (<&0 <@}./. ]) 1 _1, returns
W             =. wins %&# returns
R             =. - wins %&mean losses
R %~ _1 + W * >: R
NB. W ([ + (%~<: )~) R   NB. or this according to taste
NB. W (]%~ (<:@*>:)) R   NB. or this according to taste
NB.                          or.....
)

   kf 2 3 _1 5 _3
0.36
   kf2 2 3 _1 5 _3  NB. Devon's second version
0.36
   NB. don't see why Raul's doesn't work here!

   (M@:>:&0([ - -.@[ % (%|)/@\:~@(M/.~) @])])2 3 _1 5 _3
0.56

Cheers,
Mike

On 13/07/2018 03:50, Devon McCormick wrote:
Thanks to both of you.

Vijay - unfortunately, that expression is vulnerable to ordering
differences:

    (>&0 </. ]) 2 _1
+-+--+
|2|_1|
+-+--+
    (>&0 </. ]) _1 2
+--+-+
|_1|2|
+--+-+


On Thu, Jul 12, 2018 at 4:52 PM Vijay Lulla <[email protected]> wrote:

OOPS!  Should have been

'losses wins'=. (>&0 </. ]) returns

Sorry.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm




---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to