# Hypothesis testing for parameter of uniform distribution

I'm solving the following exercise from Larry Wasserman's book "All of Statistics".

Let $X_1, \dots, X_n\sim \text{Unif}(0,\theta)$ and let $Y = \max{X_1,\dots,X_n}$. We want to test $H_0: \theta = 0.5$ versus $H_1:\theta > 0.5$. Suppose we decide to test this hypothesis by rejecting $H_0$ when $Y > c$.

• a) Find the power function
• b) What choice of $c$ will make the size of the test $0.05$?
• c) In a sample of size $n=20$ with $Y=0.48$ what is the p-value? What conclusion about $H_0$ would you make?

The power function $\beta(\theta)$ is defined as $P_\theta(X\in R)$ where $R$ is the rejection area. So,

$$\beta(\theta) = P_\theta(Y > c) = 1 -P(\max_i X_i \le c) = 1- \prod_{i = 1}^n P_\theta(X_i\le c) = 1-c^n$$ if $\theta > c$ and $0$ otherwise. Is this correct?

For $b)$: the size is defined as $\alpha = \sup_{\theta\in\Theta_0}\beta(\theta)$. Since $\Theta_0$ is a singleton we have $$0.05 = P_{\theta_0}(Y > c) = 1-c^n\iff c = (1-0.05)^{\frac{1}{n}}$$ I think this is not correct since for $c)$: we have $n = 20$ which would imply $c \approx 0.9975$. This sounds too extreme. So where is my mistake? Moreover, for the $p$-value I would calculate:

$$p = P_{\theta_0}(\max_i X_i > 0.48) = (1-0.48^{20}) \approx 0.9999996$$ So that I would not reject $H_0$.

The issue is that under the null the density is $$2$$ for $$0
The cdf is $$2x$$ on that interval, so $$P(X_i\leq c) = 2c$$, and $$P(Y\leq c) = (2c)^n$$ and $$P(Y>c)=1-(2c)^n$$.