On Wed, Nov 24, 2010 at 3:17 PM, Chito Jovellanos <[email protected]> wrote:
> Are there other examples anyone could point me to re J implementations of
> Bayesian stats?

If you want to play with markov chains:

cummulativeP=: [: > (+/&{. (~.@[ ,: +//.)&, */&{:)&.>/

Given probabilities for a series of summable options, this gives you
various potential sums along with their probabilities.

For example, let's say you have a couple things you are
considering doing:

NB. Cost,. Probability
Event1=: |:".;._2]0 :0
  1000 0.1
   100 0.2
    10 0.3
     1 0.4
)

Event2=: |:".;._2]0 :0
   0 0.3
 654 0.7
)

And let's say that you will be trying them one after
the other:

Actions=: Event1;Event2;Event1;Event2;Event1

To get the various total potential costs from this
sequence of events, along with their probabilities:

   /:~|:cummulativeP Actions
   3 0.00576
  12 0.01296
  21 0.00972
  30 0.00243
 102 0.00864
 111 0.01296
 120 0.00486
...

Of course, if you have threshold effects which lead to diverging
choices, you will need to represent that, somehow, but this
can be a starting point.

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

Reply via email to