MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Fourier Transfer and a game?!?!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54147] Re: [mg54106] Fourier Transfer and a game?!?!
  • From: DrBob <drbob at bigfoot.com>
  • Date: Fri, 11 Feb 2005 03:35:08 -0500 (EST)
  • References: <200502100747.CAA16700@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

I'll be very curious to see a simple solution with Fourier, but in the meantime, here's a solution that takes advantage of routines I designed a couple years ago for convolving discrete distributions.

Here are the basic routines.

ClearAll[teach, values, convolve, rawConvolve, bernouilli]
bernouilli[p_] = {{0, 1 - p}, {1, p}};
rawConvolve[op_, tbl1_List, tbl2_List] := Flatten[
     Outer[{op[#1[[1]], #2[[1]]], #1[[2]]#2[[2]]} &, tbl1, tbl2, 1], 1]
rawConvolve[op_, k_, tbl_List] := Map[{op[k, #[[1]]], #[[2]]} &, tbl]
rawConvolve[op_, tbl_List, k_] := Map[{op[#[[1]], k], #[[2]]} &, tbl]
rawConvolve[op_, j_, k_] := {{op[j, k], 1}}
values[op_, tbl1_, tbl2_] := Union[{}, Column[rawConvolve[op,
     tbl1, tbl2], 1]]
teach[f_, tbl_List] := (
     ClearAll[f]; f[x_] := 0;
     Scan[(f[#[[1]]] = f[#[[1]]] + #[[2]]) &, tbl];
     )
teach[f_, k_] := (ClearAll[f]; f[x_] := 0; f[k] = 1)
teach[f_, op_, tbl1_, tbl2_] := teach[f, rawConvolve[op, tbl1, tbl2]]
convolve[f_, op_, tbl1_, tbl2_] :=
   (teach[f, op, tbl1, tbl2];
     Map[{#, f[#]} &, values[op, tbl1, tbl2]]
     )

Note that in the calls to "convolve" below, the first argument is usually a symbol that goes unused. It is the PDF function for the probability table returned by "convolve".

First, compute the conditional probability of each successive draw, given that the previous draws occurred.

drawP = Rationalize[{0.4, 0.35, 0.15, 0.1}];
successiveDrawP =
   (Most[Rest[#1]/Most[#1]] & )[
    Reverse[FoldList[Plus, 0,
      Reverse[drawP]]]]
{3/5, 5/12, 2/5}

FoldList[Times, 1, successiveDrawP]
{1, 3/5, 1/4, 1/10}

Next, define a probability table for the "indicator" variable for the i-th successive draw (conditioned on all previous draws occurring).

draw[0] = 1;
draw[i_Integer] /; 1 â?¤ i â?¤ 3 := bernouilli[successiveDrawP[[i]]]
draw@1
{{0, 2/5}, {1, 3/5}}

draw[2]
{{0, 7/12}, {1, 5/12}}

draw[3]
{{0, 3/5}, {1, 2/5}}

"vat" is the probability table for a draw of money from the vat.

vat = Transpose@{{2500, 5000, 7500, 10000}, Rationalize at {.35, .35, .15, .15}}
{{2500, 7/20}, {5000, 7/20}, {7500, 3/20}, {10000, 3/20}}

"three" is the probability table for the third draw, considering it may not occur but assuming the second draw occurred.

three = convolve[dum, Times, vat, draw[3]]
{{0, 3/5}, {2500, 7/50}, {5000, 7/50}, {7500, 3/50}, {10000, 3/50}}

"two" is the table for the total of the second and third draws, considering they may not occur but assuming the first draw occurred:

two = convolve[dum, Times, convolve[dum, Plus, vat, three], draw[2]]

{{0, 7/12}, {2500, 7/80},
   {5000, 259/2400},
   {7500, 47/600}, {10000,
    181/2400}, {12500, 7/200},
   {15000, 17/800},
   {17500, 3/400}, {20000, 3/800}}

Finally, "one" is the probability table for the total of all three draws:

one=convolve[pdf,Times,convolve[dum,Plus,vat,two],draw@1]

{{0, 2/5}, {2500, 49/400},
   {5000, 1127/8000},
   {7500, 7483/80000},
   {10000, 7959/80000},
   {12500, 399/8000},
   {15000, 799/20000},
   {17500, 513/20000},
   {20000, 639/40000},
   {22500, 297/40000},
   {25000, 27/8000},
   {27500, 81/80000},
   {30000, 27/80000}}

N@one

{{0.,0.4},{2500.,0.1225},{5000.,0.140875},{7500.,0.0935375},
{10000.,0.0994875},{12500.,0.049875},{15000.,0.03995},
{17500.,0.02565},{20000.,0.015975},{22500.,0.007425},
{25000.,0.003375},{27500.,0.0010125},{30000.,0.0003375}}

This demonstrates the pdf function:

pdf /@ one[[All,1]]
{2/5, 49/400, 1127/8000, 7483/80000, 7959/80000,
   399/8000, 799/20000, 513/20000, 639/40000,
   297/40000, 27/8000, 81/80000, 27/80000}

Bobby

On Thu, 10 Feb 2005 02:47:56 -0500 (EST), elparedblanco <cire1611 at gmail.com> wrote:

> let's say we have a probabability of picking an amount of money from a
> vat.  I can go into the vat either 0,1,2,3 times.  The probability with
> which I pick from the vat is described by the vector {.4, .35,.15,.1}.
> I call this frequency.
>
> I can pull only four amounts of money from the vat.  The amounts are
> {$2500,$5000,$7500,$10000}.  The probability of picking each amount is
> described by the vector {.35,.35,.15,.15}. I call this severity1.
>
> Process is this.  First I choose how many times I can go into the vat.
> Then I go in that many times.  I always replace what I pick out.  so it
> is possible to win $30000.
>
> The Question is what's the probabililty of winning certain amounts of
> money, such as 15,000 or 7,500 or any number, given the fact that I can
> pick multiple times?
>
> Below is the CODE and the ANSWER...I'm close, but close don't cut it.
> I think it has something to do with setting the Fourier Parameters.
>
> CODE:
>
> In[149]:=
> severity1={.35,.35,.15,.15,0,0,0,0,0,0,0,0,0,0,0,0}
>
> In[150]:=
> Length[severity1]
>
> In[151]:=
> lossList={2500,5000,7500,10000,0,0,0,0,0,0,0,0,0,0,0,0}
>
> In[161]:=
> freq={.4,.35,.15,.1,0,0,0,0,0,0,0,0,0,0,0,0,0}
>
> In[153]:=
> fftSeverity = Fourier[severity1]
>
> In[154]:=
> one = fftSeverity*Sqrt[1]*.35
>
> In[155]:=
> two = fftSeverity^2*Sqrt[1]*.15
>
> In[156]:=
> three = fftSeverity^3*Sqrt[1]*.1
>
> In[157]:=
> totalFourier = one + two + three
>
>
> In[158]:=
> finalDistribution = InverseFourier[totalFourier]
>
> In[159]:=
> Total[finalDistribution]
>
> =======================================
>
> Here's the answer..
>
> ANSWER = {.4000, .1225, .1409, .0935, .0995, .0499, .040, .0257, .016,
> .0074 .0034, .0010, .0003}
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: A nasty 2x2 system of equations?
  • Next by Date: Re: Inverse error function for arguments close to 1
  • Previous by thread: Fourier Transfer and a game?!?!
  • Next by thread: Re: Fourier Transfer and a game?!?!