Equivalence of confidence intervals and hypothesis tests While reading John Rice's Mathematical Statistics and Data Analysis (3rd edition) and I came across this theorem in Chapter 9 (page 338):

Suppose that for every $\theta_0$ in $\Theta$ there is test at level $\alpha$ of the hypothesis $H_0:\theta = \theta_0$. Denote the acceptance region of the test $A(\theta_0)$. Then the set $$C({\bf X}) = \{\theta : {\bf X} \in A(\theta)\}$$ is a $100(1-\alpha)\%$ confidence region for $\theta$.

Can someone help me understand this statement? What does $C({\bf X})$ look like? An example would be very helpful.

Let $X_1, X_2, \dots, X_9$ be a random sample from $\mathsf{Norm}{\mu, \sigma=15},$ with unknown mean $\mu.$ Suppose
$\bar X = \frac{1}{9} \sum_{i=1}^9 X_i = 92.20225$ be the sample mean,
as for the fictitious data sampled in R below.
set.seed(2022)
x = rnorm(9, 102, 15)
mean(x)
[1] 92.20225

Of course, in a real application, we would not know the true population mean.
Suppose we want to test $H_0: \mu=100$ against $H_a: \mu \ne 100$
at the 5% level.
Then the test statistic is $Z = \frac{\bar X - 100}{15/3} = -1.559549,$ as computed below.
z = (mean(x) - 100)/5;  z
[1] -1.559549

In terms of $Z,$ the acceptance region is $|Z| < 1.959964.$ So, we do not reject $H_0.$
A corresponding 95% confidence interval for $\mu$ is of the form
$$\bar X \pm 1.959964\frac{\sigma}{\sqrt{n}},$$ which
is $(82.40243, 102.00207).$
CI = mean(x) + qnorm(c(.025,.975))*(15/3);  CI
[1]  82.40243 102.00207
qnorm(c(.025,.975))
[1] -1.959964  1.959964

In terms of the test statistic $Z,$ the endpoints of this CI
are the endpoints of the 'acceptance' region.
(CI - mean(x))/5
[1] -1.959964  1.959964

In effect, on the scale of the data, the confidence interval consists of the 'acceptable'
values of $\bar X.$
