Consider $n$ iid observations $X\_1,X\_2,\dots ,X\_n$ from a $Uniform(a,b)$ distribution, where $a$ and $b$ are both unknown. How do we construct a joint confidence interval for $(a,b)$?


I would prefer a rectangular shape confidence interval, which can be obtained by using Bonferroni's method, so I guess the question can also be reformed as: How do we get a confidence interval for $a$?



Confidence intervals for the endpoints of the uniform distribution
Let $Y\_i:=\frac{X\_i-a}{b-a}$, so that the $Y\_i$'s are iid from $U(0,1)$, and for the corresponding order statistics one has $X\_{(i)}=a+(b-a)Y\_{(i)}$. Let $R\_n:=X\_{(n)}-X\_{(1)}$, the ``sample range''. Then, for any real $c>0$ 
\begin{equation\*}
 \alpha:=P(X\_{(1)}>a+cR\_n)
 =P(Y\_{(1)}>(Y\_{(n)}-Y\_{(1)})c)=P(Y\_{(n)}<Y\_{(1)}\frac{1+c}c). 
\end{equation\*}
For $n\ge2$, the joint pdf of $(Z\_1,Z\_n):=(Y\_{(1)},(Y\_{(n)})$ equals $n(n-1)(z\_n-z\_1)^{n-2}$ if $0<z\_1<z\_n<1$ and $0$ otherwise. 
So, 
\begin{equation\*}
 \alpha=\int\_0^1 n\,dz\_1\int\_{z\_1}^{1\wedge[z\_1(1+c)/c]} dz\_n\,(n-1)(z\_n-z\_1)^{n-2}
 =\int\_0^1 n\,dz\_1\, [(1-z\_1)\wedge(z\_1/c)]^{n-1}
\end{equation\*}
\begin{equation\*}
 =\int\_{c/(c+1)}^1 n\,dz\_1\, (1-z\_1)^{n-1}
 +\int\_0^{c/(c+1)} n\,dz\_1\, (z\_1/c)^{n-1}
 =\frac1{(c+1)^{n-1}}, \tag{1}
\end{equation\*}
so that 
\begin{equation\*}
 c=c\_\alpha:=\alpha^{-1/(n-1)}-1 
\end{equation\*}
and 
\begin{equation\*}
 P(X\_{(1)}-c\_\alpha R\_n<a<X\_{(1)})
 =P(X\_{(1)}-c\_\alpha R\_n\le a)=1-\alpha. 
\end{equation\*}


That is, $[X\_{(1)}-c\_\alpha R\_n,X\_{(1)}]$ is a $(1-\alpha)$-confidence interval for $a$. 


Similarly or by symmetry, $[X\_{(n)}, X\_{(n)}+c\_\alpha R\_n]$ is a $(1-\alpha)$-confidence interval for $b$. 




---


Consider now the ``joint probability''
\begin{equation\*}
 p(c):=P\big(a\in[X\_{(1)}-cR\_n,X\_{(1)}],b\in[X\_{(n)}, X\_{(n)}+cR\_n]\big), \tag{2}
\end{equation\*}
again for real $c>0$. 
By a calculation similar to, but a bit more tedious than, (1), one can obtain the following rather simple expression for $p(c)$:  

\begin{equation\*}
 p(c)=1 - 2 (1 + c)^{1 - n} + (1 + 2 c)^{1 - n}. 
\end{equation\*}
Indeed, letting $\ell(z\_1):=1\wedge(\frac{1+c}c\, z\_1\vee\frac{1 + c z\_1}{1 + c})$, we have
\begin{multline\*}
 p(c)=\int\_0^1 n\,dz\_1\int\_{\ell(z\_1)}^1 dz\_n\,(n-1)(z\_n-z\_1)^{n-2} \\
 =\int\_0^{c/(1+2c)} n\,dz\_1\, (1-z\_1)^{n-1}[1-(1+c)^{1-n}] \\ 
 +\int\_{c/(1+2c)}^{c/(1+c)} n\,dz\_1\, [(1-z\_1)^{n-1}-z\_1^{n-1}c^{1-n}] \\ 
 =1 - 2 (1 + c)^{1 - n} + (1 + 2 c)^{1 - n}. 
\end{multline\*}


By (2), $p(c)$ obviously increases from $0$ to $1$ as $c$ increases from $0$ to $\infty$. So, given any natural $n\ge2$ and any real $\alpha\in(0,1)$, one can easily find (numerically) the unique solution, $\tilde c\_\alpha$, of the equation 
\begin{equation\*}
 p(\tilde c\_\alpha)=1-\alpha. 
\end{equation\*}
Thus, with $c=\tilde c\_\alpha$, 
\begin{equation\*}
 [X\_{(1)}-c R\_n,X\_{(1)}]\times[X\_{(n)}, X\_{(n)}+c R\_n]
\end{equation\*}
is an **exact** $(1-\alpha)$-confidence rectangle for the pair $(a,b)$. 


It appears that $\tilde c\_\alpha$ differs rather little from the "Bonferroni" value $c\_{\alpha/2}$. 
E.g., for $n=10$ and $\alpha=0.05$, we have $\tilde c\_\alpha\approx0.500243$ vs. $c\_{\alpha/2}\approx0.50663$.
For $n=100$ and $\alpha=0.05$, we have $\tilde c\_\alpha\approx0.0378116$ vs. $c\_{\alpha/2}\approx0.0379643$.


Clearly, we always have $\tilde c\_\alpha<c\_{\alpha/2}$. 


