Confidence intervals for the endpoints of the uniform distribution 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$?
 A: 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}$. 
