# Stats question

1. Dec 7, 2013

### mimsy57

1. The problem statement, all variables and given/known data
Each year, a man will donate money to a charity with chance x [0,1] (chosen the first time he donated, and not changing), with the prior distribution P(x)=x^3+2x-1/4. Use Bayes law to find a posterior distribution given these observations and help the charity determine if they should expect a donation this year, given that he donated both of the last two years.

2. Relevant equations
P(x|observation)=P(observation|x)*P(x)/P(observation)

3. The attempt at a solution
I have no samples to go off of, so just hoping someone can tell me if I have the right idea:

I want to find P(x|observation) first and then the expected value of P I think. To find P(x|observation) I will do:

P(observation|x)=x^2 (because he donated twice, and P(donation)=x)
P(x)=x^3+2x-1/4 (prior distribution given)
P(ovservation)=∫(f(x)^2) from 0 to 1 (because we need the unconditional probability that f(x)=x.

Is my understanding of the above pieces correct?

2. Dec 8, 2013

### Simon Bridge

if $Y$ is the event that a man donates to charity, then $$p(y|x) = x$$ ... I think you've got that right.

I think you need to take it slowly - one step at a time: it's kind-of an odd thing to ask. How on earth would this situation get set up in the first place? But it's an exercise.

After the first observation the posterior is: $$p(x|y)=\frac{1}{p(y)}p(y|x)p(x)$$ ... p(y) is determined by normalization of the rest.

After the second observation the posterior is: $$p(x|y,y)=\cdots$$ ... write the whole thing out in symbols without anticipating their values - don't forget that the new prior is going to be the old posterior.

[note, if the third observation was no charity donation, then the posterior is $p(x|y,y,\neg y)$]

reference: http://home.comcast.net/~szemengtan/InverseProblems/chap5.pdf [Broken]
(note-I've munged the notation a bit since y is boolean)

Last edited by a moderator: May 6, 2017
3. Dec 8, 2013

### mimsy57

Thanks! I was totally missing the sequential nature.

4. Dec 8, 2013

### Ray Vickson

You can also do it non-sequentially; that is, you can regard your 'observation' as 'two donations in two years', and then compute the posterior. In other words, you get the same thing if you do it in either of two ways (but correctly each way):
$$(1) \text{ prior} \to \text{obs. 1} \to \text{post. 1} \to \text{obs. 2} \to \text{post. 2} \\ (2) \text{ prior} \to \text{obs. 1 and obs. 2} \to \text{post. 2}$$

5. Dec 8, 2013

### Simon Bridge

Yah - it's just that if you get confused like that, it is best to go by little steps.