# Calculate confidence interval when only given alpha?

Is there a formula to properly calculate the confidence interval when you're only given alpha and sample data?

Thanks!

In order to correctly construct confidence interval, first of all, you need a "pivot" T such that

1. T is a function of all data $X_1,X_2,...,X_n$
2. T is a function of $\mu$
3. The distribution of T is know, and it is not a function of $\mu$

For example, $T=\frac{\bar{x}-\mu}{\sigma/\sqrt{n}}$ is a pivot, and $T$~$N(0,1)$ regardless of the value of $\mu$ (if the sample size is large enough, say >30).

In this case, $P(a\leq T \leq b)=1-\alpha$, where $a=-Z_{\frac{\alpha}{2}}$ and $b=Z_{\frac{\alpha}{2}}$. So the "natural" confidence interval is $(\bar{x}-Z_{\frac{\alpha}{2}}(\frac{\sigma}{\sqrt{n}}),\bar{x}+Z_{\frac{\alpha}{2}}(\frac{\sigma}{\sqrt{n}}))$, where $Z_{\frac{\alpha}{2}}$ is such that $P(z>Z_{\frac{\alpha}{2}})=\frac{\alpha}{2}$.

$Z_{\frac{\alpha}{2}}$ can be calculated using the R command $qnorm(1-\frac{\alpha}{2})$

This is just an example when we know the pivot has the normal distribution. There exist other cases where the pivot we constructed doesn't have a normal distribution, and the calculation in that case would be a little bit different than this. I don't think there exists a formula that can be applied to any situation.

Hope that helps!