       Re: Experimentian with Bayesian statistics

• To: mathgroup at smc.vnet.net
• Subject: [mg45418] Re: Experimentian with Bayesian statistics
• Date: Wed, 7 Jan 2004 01:09:09 -0500 (EST)
• References: <bt8o98\$c1u\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```NA <nospam at here.com> wrote in message news:<bt8o98\$c1u\$1 at smc.vnet.net>...
> Hi,
> I'm trying to learn some basic Bayesian statistics with Mathematica but I'm
> having trouble building up the probability formulae that I need.
>
> I tried to define
>
> depPr[x_,y_] := (Pr[x] depPr[y,x]) / Pr[y]
>
> but I don't even get an Out result  (I thought it would have at least
> redisplayed it with numerator over denominator)
>
> (I assumed by the way that I needed a different name for the function   Pr{x
> | y} vs the simple  Pr{x})
>
>
> If I replace the ':=' with '=', then I just get a recursion error.
>
[...]
This is an example of what you could do to prevent recursion :

In:=ClearAll[p];
p[a_[r_Integer(* event number *), n_Integer(* number of events *)],b_]:=
p[b,a[r,n]]p[a[r,n]] / Sum[p[b,a[i,n]]p[a[i,n]],{i,1,n}];

Numeric example :

In:=
p[a[1,2]] = 1/10;
p[a[2,2]] = 9/10;
p[b,a[1,2]] = 1/3;
p[b,a[2,2]] = 1/60;

In:=p[a[1,2],b]

Out=20/29

In:=p[a[2,2],b]

Out=9/29

hth
---
jcp

```

• Prev by Date: Quantum algebra package
• Next by Date: Re: Mathematica exports curves in pieces to Illustrator
• Previous by thread: Experimentian with Bayesian statistics
• Next by thread: Interpolating function