# Bayes estimator (Inference)

An urn contain 5 balls, $\theta$ white and $5 - \theta$ green. The experiment consists in grab 2 balls from the urn and register the pair $(x_1, x_2)$, where $x_i = 1$ if we observe a white ball and $x_i = 0$ otherwise. What is the bayes estimator $\theta^*$ for $\theta$ considering the squared loss function? (i.e $l(\theta,\theta^*) = (\theta - \theta^*)^2$)

I can't figure out which posterior distribution I should use or even if I need to use one. I calculated my loss function considering all the possible values for $\theta$ and $\theta^*$ but I can't calculate the risk function without the posterior function. Can someone help me with it??

I can't find out what to do with the ordered pair, I just calculated the probability of each pair

• Don't you need a prior? Sep 28, 2013 at 14:08
• Yes, I do. I was thinking to give equal probability for each value of $\theta$ using $f(\theta) = 1/6$ for $\theta = 0,...,6$ or not consider only integer values and put an uniform distribution. But I don't have any idea how to finish this problem. Sep 28, 2013 at 14:39
• Or I can find a posterior using bayes theorem but I'm stuck in this idea too. Sep 28, 2013 at 14:40
• Maybe this can help: stat.cmu.edu/~larry/=stat705/Lecture8.pdf Look at Theorem 7. With a squared loss function the Bayes estimator is the mean of the posterior distribution. So if you use your uniform prior and calculate the posterior you just need to find the mean of it. Sep 28, 2013 at 14:54
• Thank you hejseb, but I am having troubles to "see" the problem. When I use an uniform distribution for my prior, $\theta$ is usually a proportion or a probability for something. But, in this case, my $\theta$ is a number between 0 and 5. How can a uniform model this? And using an uniform distribution, what distribution for $X_i$ should I use to get a known distribution for my posterior? Maybe a bernoulli with parameter $\theta/5$ ? Sep 28, 2013 at 15:43

Start with your prior. Since you have no information about the value of $\theta$ except that it's an integer between $0$ and $5$ a uniform prior is appropriate $P(\theta=0)=\dots=P(\theta=5)=1/6$
Then calculate your likelihoods $P(X_1=x_1,X_2=x_2|\theta=n)$ (which I'll abbreviate to $P(x_1,x_2|n)$).
Finally to use Bayes' rule you need $P(x_1,x_2)$ to go on the denominator. You can calculate this from the things you already have by using: $$P(x_1,x_2)=\sum_{n=0}^5 P(x_1,x_2|n).P(\theta=n)$$ (This is called the Law of Total Probability)
Then you can calculate your posterior with Bayes: $$P(\theta=n|x_1,x_2)=\frac{P(x_1,x_2|n).P(\theta=n)}{P(x_1,x_2)}$$ and from there you can minimise your expected loss (it's a property of the squared loss function that it's minimised by the mean of the posterior).
• ok, I already did it. But, how can I find the mean of $\theta | x_1,x_2$ ? I mean, there is no drawn for I give a concrete formula for my posterior distribution to calculate by hand the mean. What should I do? Consider all the pairs (0,1),(1,0),(1,1),(0,0)? In the bottom of the bayes equation, we will need to use both, but I dont get what will be $P(x_1, x_2 | n)$ if I don,t even have x_1, x_2 Sep 28, 2013 at 17:14
• Yeah, do the problem four times, for each of the pairs $(x_1,x_2)=(0,0),(0,1),(1,0),(1,1). You only really need to do it three times since (0,1) will give the same answer as (1,0). Sep 28, 2013 at 17:48 • Or you could try to write$P(x_1,x_2|\theta) as a function of $x_1+x_2$ and $\theta$ so you only have to do the calculation once. This would be the "hypergeometric distribution". Sep 28, 2013 at 17:50
• ok, the last one looks like a better idea. But, could we use the fact that $f(\theta | (x1,x2) ) \propto L_X(\theta)f(\theta)$, where $L_X(\theta)$ is the likelihood function? So we will have: $f(\theta|x_1, x_2) \propto (5-\theta)^3 \theta^3 (4-\theta)$ Is that correct? Sep 28, 2013 at 17:55