Had the following question on my exam today and I'm just wondering if I did this correctly.
From a normally distributed population with mean $\mu$ and variance $\sigma^2$ a sample has been drawn:
$$\mathbf{X}=(0.05,4.35,-0.48,-0.63,1.17,2.01).$$
a) Test $H_0 : \mu=0$ against $H_A: \mu > 0$ on a $5$% significance level under the assumption that $\sigma^2$ is unknown.
c) Do the same test, given that $\sigma=1.5.$
Solution: I know that $H_0$ is to be rejected if $T\geq c,$ where $T$ is the teststatistic and $F_{t_{n-1}}=1-\alpha,$ where $\alpha$ is the significance level.
So lets first compute them for a), where we need to use a $t$-distribution since $\sigma$ is unknown, so we have that $c=F^{-1}_{t_5}(0.95)\approx2.015.$ Also, the estimator for $\sigma^2$ is
$$s^2=\frac{1}{n-1}\left(\sum_{k=1}^{n}X_k^2-\frac{1}{n}\left(\sum_{k=1}^{n}X_k\right)^2\right)=\frac{1}{5}(24.961-\frac{1}{6}(41.861))=3.405,$$
so, $s=\sqrt{3.405}=1.845.$ We also have that $\overline{X}=6.47/6=1.078.$
The teststatistic is
$$T=\frac{\overline{X}-\mu_0}{s/\sqrt{n}}=\frac{1.078-0}{1.845/\sqrt{6}}=\frac{1.078}{0.753}=1.43\leq c,$$
which means that we can not reject $H_0.$
For b) we do an identical approach but wtith $s=\sigma=1.5$ and we use a $z$-test instead. Here we have that $c = \Phi^{-1}(0.95)=1.644.$ The teststatistic in this case is
$$Z=\frac{\overline{X}-\mu_0}{\sigma/\sqrt{n}}=\frac{1.078}{1.5/\sqrt{6}}=1.76\ge c,$$
thus we reject $H_0.$
Is this correct?
What my professor does in the solutions is he just makes a $95$% confidenceinterval and just arrives to the same conclusions as I've done. Is his method correct without using the teststatistics?
Yes, your solution is indeed correct. You are doing exactly what is required to, while your professor is solving a bit more general problem, namely constructing the $95\%$ confidence interval and then checks whether given values are inside this interval or no.
This, I think, is just a manner of habit. I, personally, am used to the one presented in your post.