This is just a comment to the other excellent answer by Damian Pavlyshyn noting that when $|\bar x|$ is too small, the confidence set defined by $\{|\mu|:P_{|\mu|}(|\bar X|\le |\bar x|)\le 1-\alpha\}$ will include 0 since the left hand side of $$ \Phi\left(\frac{\bar x-|\mu|}{\sigma/\sqrt{n}}\right)-\Phi\left(\frac{-\bar x-|\mu|}{\sigma/\sqrt{n}}\right)=1-\alpha, $$$$ \Phi\left(\frac{|\bar x|-|\mu|}{\sigma/\sqrt{n}}\right)-\Phi\left(\frac{-|\bar x|-|\mu|}{\sigma/\sqrt{n}}\right), $$ being the probability that $\bar X$ falls between $-\bar x$ and $\bar x$, will then always be smaller than $1-\alpha$. The result of this is that Still, the real coverage will be somewhat greater thanappears to match the nominal level whenof $|\mu|$ is small$1-\alpha$ as shown inindicated by the following simulation:.
pfoldnorm <- function(x, mu, sigma) {
pnorm((x-mu)/sigma) - pnorm((-x-mu)/sigma)
}
lowerbound <- function(x, alpha=0.05) {
n <- length(x)
xbarabsxbar <- abs(mean(x))
f <- function(mu) {
pfoldnorm(xbarabsxbar, mu, 1/sqrt(n)) - 1 + alpha
}
if (f(0)<=0)
return(0)
else
uniroot(f, c(0, 100))$root
}
coverage <- NULL
mu <- seq(0, 2, by=.1)
for (i in seq_along(mu)) {
hits <- replicate(1e+5,{
x <- rnorm(1, mu[i])
l <- lowerbound(x, .05)
l <= abs(mu[i])
})
coverage[i] <- mean(hits)
}
plot(mu, coverage)
abline(h=.95, col="green")


Created on 2025-11-01 with reprex v2.1.1