# Calculating the risk of an estimator using zero-one loss

Consider two observations where $$P_\theta(x=\theta+1)=P_\theta(x=\theta-1)=0.5,\ \ \theta\in\mathbb{R}$$Let $\mathbb{D}=\Theta=\mathbb{R}$ the decision space. Suppose that the associated loss is $$L(\theta,\delta)=1-\mathbb{I}_\theta(\delta)$$ where $\mathbb{I}_\theta(\theta)=1$ and $\mathbb{I}_\theta(\delta)=0$ otherwise. Consider the following decision rules $$\delta_0(x_1,x_2)=\frac{x_1+x_2}{2}$$ $$\delta_1(x_1,x_2)=x_1+1$$ and show that $$R(\theta,\delta_0)=R(\theta,\delta_1)=0.5$$ where $\forall\delta\in \mathbb{D}, R(\theta,\delta)=\mathbb{E}_\theta(L(\theta,\delta))$.

I'm really lost in this exercise, I know that $$R(\theta,\delta)=\int x L(\theta,\delta(x))f(x|\delta(x))dx$$ I'm completely caught in this exercise, can someone give me a litle help?

$$R(\theta,\delta)=\int x L(\theta,\delta(x))f(x|\delta(x))\text{d}x$$

is doubly incorrect. It should be$$R(\theta,\delta)=\int \overbrace{L(\theta,\delta(x))}^{\text{no }x}\underbrace{f(x|\theta)}_{\theta\text{ not }\delta(x)}\text{d}x$$

In this special case of yours $X$ has a finite support $\{\theta-1,\theta+1\}$, the integral is thus a sum and the risks are given by \begin{align*} R(\theta,\delta_0)&=\sum_{x_1,x_2} L(\theta,\delta_0(x_1,x_2))\mathbb{P}(X_1=x_1,X_2=x_2)\\ &=L(\theta,\delta_0(\theta+1,\theta+1))\mathbb{P}(X_1=\theta+1,X_2=\theta+1)\\ &\ +L(\theta,\delta_0(\theta+1,\theta-1))\mathbb{P}(X_1=\theta+1,X_2=\theta-1)\\ &\ +L(\theta,\delta_0(\theta-1,\theta1))\mathbb{P}(X_1=\theta-1,X_2=\theta+1)\\ &\ +L(\theta,\delta_0(\theta-1,\theta-1))\mathbb{P}(X_1=\theta-1,X_2=\theta-1)\\ &=L(\theta,\theta+1))\mathbb{P}(X_1=\theta+1,X_2=\theta+1)\\ &\ +L(\theta,\theta)\mathbb{P}(X_1=\theta+1,X_2=\theta-1)\\ &\ +L(\theta,\theta))\mathbb{P}(X_1=\theta-1,X_2=\theta+1)\\ &\ +L(\theta,\theta-1)\mathbb{P}(X_1=\theta11,X_2=\theta-1)\\ &=.25\{\mathbb{I}_{\theta\ne\theta+1}+\mathbb{I}_{\theta\ne\theta}+\mathbb{I}_{\theta\ne\theta}+\mathbb{I}_{\theta\ne\theta-1}\}\\ &=.5 \end{align*} and \begin{align*} R(\theta,\delta_1)&=L(\theta,\delta_1(\theta+1))\mathbb{P}(X=\theta+1)+L(\theta,\delta_1(\theta-1))\mathbb{P}(X=\theta-1)\\ &=.5\{L(\theta,\delta_1(\theta+1))+L(\theta,\delta_1(\theta-1))\} \\&=.5\{\mathbb{I}_{\theta\ne\delta_1(\theta+1)}+\mathbb{I}_{\theta\ne\delta_1(\theta+1)}\}\\ &=.5\{\mathbb{I}_{\theta\ne\theta+2}+\mathbb{I}_{\theta\ne\theta}\}\\ &=.5 \end{align*} In conclusion, both estimators are sharing the same risk.

There exists another estimator $\delta_2(X_1,X_2)$ that achieves a risk of $0.25$, can you find it?

• Thank you man, now I understood how to the calculations. – user72621 Mar 13 '16 at 23:43
• You mean achieves a risk 0.5? – user72621 Mar 14 '16 at 15:08
• If $\delta_2(X_1,X_2)=\frac{x_1+x_2}{2}-1$ then $R(\theta,\delta_2)=0.25$ – user72621 Mar 15 '16 at 0:29
• This is not the answer since this new estimator is inexact 75% of the time! – Xi'an Mar 16 '16 at 15:38

Here $L(\theta, \delta)$ is called the zero-one loss function because the loss is zero when you estimate $\theta$ exactly, otherwise the loss is one. As the problem states the risk is just the expected value of this function taken with respect to the distribution of our estimator which for zero-one loss simplifies nicely to a probability

\begin{align} R(\theta, \delta) &= \text{E}_\delta[L(\theta, \delta)] \\ &= P(\delta \neq \theta) . \end{align}

So all you need to show is that $\delta_1$ and $\delta_0$ are right half the time based on the two observations $X_1$ and $X_2$. For $\delta_0$ notice that this estimator will equal $\theta$ if and only if $X_1 \neq X_2$ which you can verify will happen half the time. $\delta_1$ will equal $\theta$ if only if $X_1 < \theta$ which again happens half the time, and you are done.

• So I need to show that $$P(\delta_0=\theta)=P(\delta_1=\theta)$$?I see the only way to prove this equality is making statements about $X_1$ and $X_2$ as you did. – user72621 Mar 12 '16 at 23:06
• No, you need to show that both probabilities equal $1/2$ as the problem states. You do this by looking at how either estimator can equal $\theta$, and there are only a few cases to check. – dsaxton Mar 12 '16 at 23:25
• I'm still not following you, by estimator you mean decision rule? I'm really losted in bayesian inference. – user72621 Mar 12 '16 at 23:50
• $\delta$ is an estimator for $\theta$, I guess you can call it a decision rule. Also this really isn't a Bayesian problem at all. – dsaxton Mar 12 '16 at 23:55