Haha, you weren't kidding when you said the problem got you two geeking.
I ended up using a recursive function that went through a list of PN's and built toward the target, Y, while keeping track of the probability of the path it was on (and summing them as the recursion returned). At each stage it branched into "heads" and "tails" (multiplying by the correct probabilities) and then continued on. When you hit the target, the probability (for that stage) was 1, or when you hit the end of the list it was 0. I think it's the same thing as your method except it doesn't differentiate between [1,1,1,1] and [1,1,1,-1] when Y = 3 (just bundles the N=4 cases together and says 1).
This code was actually for the case where Y was the sum of the value of all coins that landed heads and the value of each coin flip, VN=PN, but then I realized that with a few parameters you could set the VN and Y to be whatever you want and converted it to then handle my other more standard calculation (it was actually to combine a number of the previous experiments and judge how likely you would be to get Z successful experiments).
I'm not sure that it's mathematically sounds given my actual case (for me Y is a threshold target for an expected value function and VN is really PN*1), but it's an interesting problem.
(no subject)
Date: 2008-04-29 02:51 pm (UTC)I ended up using a recursive function that went through a list of PN's and built toward the target, Y, while keeping track of the probability of the path it was on (and summing them as the recursion returned). At each stage it branched into "heads" and "tails" (multiplying by the correct probabilities) and then continued on. When you hit the target, the probability (for that stage) was 1, or when you hit the end of the list it was 0. I think it's the same thing as your method except it doesn't differentiate between [1,1,1,1] and [1,1,1,-1] when Y = 3 (just bundles the N=4 cases together and says 1).
This code was actually for the case where Y was the sum of the value of all coins that landed heads and the value of each coin flip, VN=PN, but then I realized that with a few parameters you could set the VN and Y to be whatever you want and converted it to then handle my other more standard calculation (it was actually to combine a number of the previous experiments and judge how likely you would be to get Z successful experiments).
I'm not sure that it's mathematically sounds given my actual case (for me Y is a threshold target for an expected value function and VN is really PN*1), but it's an interesting problem.