> [!tldr] > Confidence intervals, tests, and p-values are interconvertible. This allows us to find confidence intervals for general random variables. > [!definition|*] Confidence Intervals, Tests, p-values > A set $C(\mathbf{X})$ is a CI at confidence level $1- \alpha$ if $\mathbb{P}_{\theta_{0}}[\theta_{0} \in C(\mathbf{X})] \ge 1-\alpha.$ > > A tests at level $\alpha$ satisfies $\mathbb{P}_{\theta_{0}}[H_{0}:\theta=\theta_{0} \text{ is rejected}]\le \alpha.$ > > A p-value $p(\mathbf{X})$ satisfies (for all $\alpha$) that $\mathbb{P}_{\theta_{0}}[p(\mathbf{X}) \le \alpha]\le\alpha.$ > [!warning]- Nitty Gritty Discrete Stuff > The $\le$ is not necessary if the CDF of $\mathbf{X}$ is invertible, but in general (especially for discrete RVs), the **nominal level** $\alpha$ might not correspond to any quantile. That is, $\not \exists x :\mathbb{P}[X\le x]=\alpha \,\text{ exactly.}$In that case, we settle for $x_{\alpha}$ where $x_{\alpha}:= \max_{x} \Big\{ \mathbb{P}[X \le x]\,\le\,\alpha\Big\}.$With this quantile, the **actual level** of the test/CI is $\mathbb{P}[X < x]=: \alpha ^{*}$, which is less (hence stronger than) $\alpha$. ## Converting between CI and Tests It is easy to derive a test based on CI's or p-values, but it is also possible to in the reverse direction, in particular defining a CI using a test: ![[Confidence Intervals#^551219]] - Hence chaining conversions allow us to start with a p-value, define a test with level $\alpha$, and then gain a CI with confidence level $1-\alpha$. > [!idea] CI for continuous RVs > For a generic continuous random variable $X$ with cdf $F_{X}(\cdot\,; \theta)$, $F_{X}(X;\theta) \sim U[0,1]$, so it induces a test with test statistic $T(X):= F_{X}(X;\theta_{0}) \sim U[0,1] \text{ under }\theta=\theta_{0}.$ > and by extension a CI of $\theta$. > > For example a two-sided CI of $T$ with level $\alpha$ is given by $\left\{ \theta_{0}: F_{X}(X_{\mathrm{obs}};\theta_{0}) \in \left( \frac{\alpha}{2}, 1-\frac{\alpha}{2} \right) \right\}.$