# How to find confidence interval for theta in this case?

My question is following: Suppose that $$X\sim N(\theta,1)$$. and $$\theta \geq 0$$. When $$X=-2$$ is observed, how can I construct a 95% confidence interval for $$\theta$$? This case is not usual for me because of the condition that $$\theta\geq 0$$. I've tried to find proper pivot variables but it was not easy.

Is there any proper pivot variable or other ways to construct a 95% confidence interval in this case?

• @user2974951: not even in the present situation, where the parameter is known to be nonnegative, but the observation is negative? Sep 12 '19 at 10:54
• @user2974951 That's incorrect. Indeed, it's possible to construct a CI for a single observation from a Normal distribution even when both parameters are unknown.
– whuber
Sep 12 '19 at 13:16
• Sep 12 '19 at 13:44
• @StephanKolassa If $\theta = -2$, then $X=-2$ is perfectly valid. Or did I miss something?
– Dave
Sep 13 '19 at 0:02
• @Dave: the OP noted that $\theta$ is constrained to be nonnegative. Which of course still allows an observation $x=-2$. Sep 13 '19 at 3:02

Let's think about this from first principles. A confidence interval (in this context) is given by a pair of functions $$l$$ and $$u.$$ Setting $$\alpha=95/100,$$ their defining properties are

1. For all numbers $$x,$$ $$l(x) \le u(x).$$ This means the interval $$[l(x),u(x)]$$ is well-defined and non-empty.

2. No matter what $$\theta\in [0,\infty)$$ might be, $$\alpha \le \Pr(l(X) \le \theta \le u(X))\tag{1}$$ and there exists at least one such $$\theta$$ for which this is an equality.

This probability obviously is determined by $$\theta$$--there's no getting around that--but maybe we can make progress by computing it explicitly.

This task is simplified by adopting the intuitively natural idea that both $$l$$ and $$u$$ ought to increase monotonically with $$x,$$ since larger values of $$X$$ are more likely to be drawn from distributions with larger $$\theta.$$ It's also clear we may assume $$l$$ and $$u$$ are continuous functions of $$x.$$ Consequently $$l$$ and $$u$$ are invertible and the probability in $$(1)$$ can be re-expressed in terms of the standard Normal distribution function $$\Phi$$ as

\eqalign{ \alpha&\le \Pr(l(X) \le \theta \le u(X)) \\&= \Pr(X \in [u^{-1}(\theta), l^{-1}(\theta)]) \\&= \Phi(l^{-1}(\theta)-\theta) - \Phi(u^{-1}(\theta)-\theta).\tag{2}} The left plot graphs the confidence limits against $$X$$ and compares them to $$\theta.$$ Any given $$\theta$$ will tend to produce values of $$X$$ near $$\theta$$ itself. Provided the interval from $$u^{-1}(\theta)$$ up to $$l^{-1}(\theta)$$ (shown as the horizontal blue line segment) has at least $$95\%$$ chance of containing $$X,$$ no matter what the value of $$\theta$$ might be, the functions $$(l,u)$$ will satisfy defining inequality $$(1).$$ Having observed $$X,$$ the confidence interval is the vertical red segment. The right plot shows how these limits are changed to accommodate the restriction $$\theta\ge 0.$$

Forgetting momentarily that $$\theta\ge 0,$$ it is easy--via inspection--not only to find a pair of such functions $$l_0,u_0,$$ but even a pair that (a) makes the confidence intervals as narrow as possible and (b) makes the confidence level always equal to $$\alpha:$$ namely, set

$$l_0^{-1}(\theta) - \theta = \Phi^{-1}((1 - \alpha)/2)$$

and $$u_0^{-1}(\theta) - \theta = \Phi^{-1}(1 - (1 - \alpha)/2).$$

The unique solutions are

$$l_0(x) = x - \Phi^{-1}((1 - \alpha)/2);\ u_0(x) = x - \Phi^{-1}(1 - (1 - \alpha)/2) = x + \Phi^{-1}((1 - \alpha)/2).$$

How should this solution be modified given $$\theta\ge 0$$? The obvious thing to try is to "clamp" the confidence interval to this range. In other words, take the confidence interval to be the intersection of the interval $$[l_0(X),u_0(X)]$$ with $$[0,\infty).$$ That is,

$$l(x) = \max(0, x - \Phi^{-1}((1 - \alpha)/2));\ u(x) = \max(0, x + \Phi^{-1}((1 - \alpha)/2)).$$

Because this does not modify either $$l^{-1}$$ or $$u^{-1}$$ for $$\theta \gt 0$$ (see the right hand figure above), the inequality $$(2)$$ continues to hold. Thus, $$(l,u)$$ is a confidence interval for $$\theta.$$

• Am I correct to say that in the OPs example with $x=-2$, the confidence limits are both $0$? Using $\alpha = 0.95$, we have $\Phi^{-1}((1 - 0.95)/2)) \approx -1.96$ so that $-2 - (-1.96) = -0.04$ and $-2 + (-1.96) = -3.96$? Or am I missing something? Sep 13 '19 at 6:27
• @COOL That is correct: when $X$ is extremely negative, it's ok to estimate that $\theta=0$ and to erect a minimal confidence interval around that estimate. This is because no matter what value $\theta$ might have, the chance that $X$ is this small is acceptably low.
– whuber
Sep 13 '19 at 12:37