# On finding a confidence interval. (exercise)

I am having some problems with the second point of this exercise

Let $(X_1, \dots, X_n)$ be a random sample extracted from a population $X$ that is distributed as a uniform $(0, \theta)$ and let $Y_n = \max (X_1, \dots, X_n)$.

1) If one puts $Q( \theta, X_1 \dots X_n) = Y_n / \theta$ prove that the distribution of $Q$ does not depend on $\theta$.

2) Show how it is then possible to construct a confidence interval for $\theta$.

For point 1 I proceeded as follows (aside from the obvious cases $y < 0, y > 1$) $$P(Y_n / \theta < y) = P(Y_n < y\theta) = (F_X(y \theta))^n = (y\theta / \theta )^n = y^n$$

For point 2 I am a bit lost, anyone mind lending a hand?

• Please add [self-study] tag (stats.stackexchange.com/tags/self-study/info) – Tim Jul 20 '16 at 11:54
• @Tim thanks! must say that it is a bit confusing that self-study means two different things in mathstackexchange and crossvalidated. Just noticed it now. I like the guidelines you have here. – Monolite Jul 20 '16 at 12:03
• For a CI, you want something like $P(a < \theta < b)=1-\alpha$ which is equivalent to $P(\frac{1}{b} < \frac{1}{\theta}< \frac{1}{a})=1-\alpha$ or $P(\frac{Y_n}{b} < \frac{Y_n}{\theta}< \frac{Y_n}{a})=1-\alpha$. Then you can use what you got from (1). – JACKY Li Jul 20 '16 at 12:04
• @PatrickLi Thanks! but what is $P( \frac{Y_n}{\theta}< \frac{Y_n}{a})$ is it $(Y_n /a )^n$? no that can't be. Sorry I am a bit confused how do I use (1) with all the random variables. Do I do $P( Y_n (a - \theta) /(a \theta) < 0 ) = ?$. – Monolite Jul 20 '16 at 12:13

For a $100(1-\alpha)\%$ two-sided confidence interval, you want to find $a$ and $b$ such that $P(a < \theta < b) = 1-\alpha$. It is equivalent to $P\left(\frac{Y_n}{b} < \frac{Y_n}{\theta} < \frac{Y_n}{a}\right)=1-\alpha$. So $\frac{Y_n}{b}$ will be the $\frac{\alpha}{2}$ percentile of the distribution of $\frac{Y_n}{\theta}$ and $\frac{Y_n}{a}$ is the $1-\frac{\alpha}{2}$ percentile so the area in between is $1-\alpha$.

In (1), you have that the CDF of $\frac{Y_n}{\theta}$ is $y^n$. Then you can have $\left(\frac{Y_n}{b}\right)^n=\frac{\alpha}{2}$ and $\left(\frac{Y_n}{a}\right)^n=1-\frac{\alpha}{2}$. You can solve for $a$ and $b$ as \begin{align*} a &= \dfrac{Y_n}{\left(1-\frac{\alpha}{2}\right)^{1/n}}\\ b &= \dfrac{Y_n}{\left(\frac{\alpha}{2}\right)^{1/n}} \end{align*}

A $100(1-\alpha)\%$ confidence interval for $\theta$ is $\left[\dfrac{Y_n}{\left(1-\frac{\alpha}{2}\right)^{1/n}}, \dfrac{Y_n}{\left(\frac{\alpha}{2}\right)^{1/n}}\right]$.

A simple simulation in R:

> x <- runif(100, 0, 10)
> max(x)
[1] 9.924173
> max(x)/(1-0.025)^(1/100) # lower bound
[1] 9.926686
> max(x)/(0.025)^(1/100) # upper bound
[1] 10.2971

• Thanks again, I guess what confuses me is that $\left[\dfrac{Y_n}{\left(1-\frac{\alpha}{2}\right)^{1/n}}, \dfrac{Y_n}{\left(\frac{\alpha}{2}\right)^{1/n}}\right]$ is a random interval. I mean we don't get a interval of real numbers. Probably I don't understand confidence intervals correctly. – Monolite Jul 20 '16 at 13:10
• @Monolite Yes, confidence interval is a random quantity. If you get a different data set, you will have a different interval. But for a given data set, you will have numbers. – JACKY Li Jul 20 '16 at 13:13
• Patrick I was looking at this answer again and I have a doubt: do you mean $\left(\frac{Y_n}{b}\right)^n=\frac{\alpha}{2}$ or $\left(\frac{Y_n}{b}\right)^n=$ the corresponding percentile of $\frac{\alpha}{2}$ ? – Monolite Sep 3 '16 at 15:57