Is there an intuitive argument for the correct bounds of a confidence interval in a one-sided hypothesis test?

Assume I have a hypothesis

$$H_0: \mu \leq 0$$ $$H_1: \mu > 0$$

which corresponds to R's alternativ "greater" and which I would like to check with a confidence level of $$95\%$$ ($$\alpha = 0.05$$). I thought the confidence interval (CI) must be of the form $$\left(- \infty, a\right]$$, which is wrong. Is there an intuitive argument for the opposite? Long form:

Lets assume we have $$n=10$$ measuremts with $$\bar{x} = -9.603$$ and $$s_x = 2.342$$ as in the R example below. For a two-sided test (without any bias) it is clear that the CI can be calculate to be $$\left[\bar{x}-c\cdot\frac{s_x}{\sqrt{10}}, \bar{x}-c\cdot\frac{s_x}{\sqrt{10}}\right] = \left[-11.28, -7.93\right]$$

using the t-distributiuon $$F_9(c) = 1 - \frac{\alpha}{2}$$.

But in my case I want to consider a one-sided test and I thought about the two options (here $$F_9(c) = 1 - \alpha$$)

1. $$\left(- \infty, \bar{x}-c\cdot\frac{s_x}{\sqrt{10}}\right]$$
2. $$\left[\bar{x}-c\cdot\frac{s_x}{\sqrt{10}}, +\infty\right)$$

At first, my intuition for $$H_0: \bar{x} \leq 0$$ told me that the first option should be correct: "$$-\infty$$ is less 0". But when looking at the hypothesis test, I realized, I was wrong.
Our test statistics is $$t = \frac{\bar{x} - 0}{s_x/\sqrt{n}} = -12.968$$ and our cut off value is $$c = F^{-1}(1 - \alpha) = 1.833$$ resulting in a p-value of $$1 - F_9(t) \approx 1$$. Thus, we accept the null-hypothesis, because $$t < c$$ or $$p > \alpha$$ (as expected from the values!).

If we look at the two intervals, it is clear (the result must be the same!) that the second option is correct. whereas the first is wrong:

• $$0 \notin \left(-\infty, -8.25\right]$$
• $$0 \in \left[-10.96, +\infty\right)$$

Some references:
(1), (2) , (3) and (4) (Null hypothesis for directional tests),

Working example in R:

set.seed(1)
conf_level <- 0.95
x <- rnorm(10, -10, 3)
xm <- mean(x)
sx <- sd(x)
print(paste0("Mean = ", xm))
print(paste0("Standard deviation = ", sx))
mu0 <- 0
# H_0: mean(x) < 0 (which is true)
print(t.test(x, mu = 0,alternative = "greater", conf.level = conf_level))

n <- length(x)
t <- (xm - mu0)/(sx/sqrt(n)) # tests statistics
print(paste0("t = ", t))
df <- n - 1
print(paste0("df = ", df))
alpha <- 1 - conf_level # probability type I error

c_val <- qt(1 - alpha, df = df)

p_value <- 1 - pt(t, df)
print(paste0("p_value = ", p_value))

# confidence interval
cint <- qt(1 - alpha, df = df) * sqrt(sx^2/n)
cint <- xm + c(-Inf, cint)
print(paste0("CI1 = (", paste(cint, collapse = ", "), "]"))

cint <- qt(1 - alpha, df = df) * sqrt(sx^2/n)
cint <- xm + c(-cint, Inf)
print(paste0("CI2 = [", paste0(cint, collapse = ", "), ")"))


Suppose you are testing a plan of medical care and diet that will help badly malnourished babies gain weight. You have $$n = 10$$ subjects. After a week on the plan you measure the change in weight of each child in ounces (an ounce is about 30g).

Your null hypothesis is that the population mean weight of such children stays the same or decreases, and the alternative hypothesis (research hypothesis) is that the mean weight increases: $$H_0: \mu \le 0$$ vs. $$H_a: \mu > 0.$$

One difficulty with your question is that you are mixing up the notation for population parameters with the notation for sample statistics. Notice that the null and alternative hypotheses are stated in terms of population parameters.

Upon finding actual weight changes $$X_1, X_2, \dots X_{10},$$ you find the following summary statistics for your sample of 10 children.

summary(x)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
-12.507 -11.639  -9.230  -9.603  -8.339  -5.214
sd(x)
[1] 2.341758


This is bad news because weight changes are mainly negative. In particular, the sample mean is $$\bar X = \frac 1n \sum_{i=1}^n X_i = -9.603$$ and the sample standard deviation is $$S = \sqrt{\frac{1}{n-1}\sum_{i=1}^n (X_i - \bar X)^2} = 2.342.$$

A 95% (2-sided) confidence interval for the population mean weight gain $$\mu$$ is of the form $$\bar X \pm t^*\frac{S}{\sqrt{n}},$$ where $$t^*$$ cuts 2.5% of the probability from the upper tail of Student's t distribution with $$\nu = n-1$$ degrees of freedom. For your data this computes to $$(-11.28,-7.93).$$ The computation of this confidence interval is included in the t.test procedure in R. (You did the computation correctly, but used the wrong notation.)

t.test(x)$conf.int [1] -11.278584 -7.928199 attr(,"conf.level") [1] 0.95  If you use R to test $$H_0: \mu \le 0$$ vs. $$H_a: \mu > 0,$$ then the syntax and output from R are as shown below: t.test(x, mu=0, alte="g") # 'g' for 'greater' One Sample t-test data: x t = -12.968, df = 9, p-value = 1 alternative hypothesis: true mean is greater than 0 95 percent confidence interval: -10.96086 Inf sample estimates: mean of x -9.603392  The P-value is 1. In order to reject $$H_0$$ at the 5% level (and conclude that the program is helping the children gain weight), you would need a P-value below 5%. Ordinarily, a P-value at or near 1 means that something is wrong with the model or the hypothesis. In this case, results are unexpectedly bad and the program is not working as intended. (Unless you have prior experience with such programs and subjects to warrant an expectation that children will gain weight, it is probably better to start with a two-sided alternative.) The interpretation of the one-sided 95% confidence interval $$(-10.96, \infty)$$ in the R output just above is something like this: "Not only did the the program fail to help the children as intended, the actual change in weight could be a loss of as much as $$10.96$$ ounces." In this particular example, the data were simulated from the population $$\mathsf{Norm}(\mu = -10, \sigma = 3).$$ Usually, using real data, one does not know the population parameters for sure. We would not know that it was correct not to reject $$H_0;$$ we would not know that the 2-sided confidence interval $$(-11.28,-7.93)$$ truly does contain $$\mu = -10;$$ nor would we know that the one-sided confidence interval $$(-10.96, \infty)$$ from the one-sided test procedure also contains $$\mu = -10.$$ In summary, there are several issues with your question potentially leading to confusion: (1) Incorrect use of $$\mu$$ and $$\sigma$$ to represent sample mean and standard deviation. (2) Unfortunate choice of a one-sided alternative for the test of hypothesis leading to a huge P-value. (3) The one-sided confidence interval that is included in R output for a right-sided alternative may not give you the information you most wanted from a confidence interval. You might find it instructive to go through the steps above starting with data y = rnorm(10, 10, 3); still using the right-sided alternative and presumably rejecting $$H_0$$; interpreting the accompanying one-sided confidence interval which now gives a positive lower bound. It is a nice idea to add print statements to the standard R code that will include German terminology, but don't use population notation to label sample statistics. Also, as you probably know, most browsers will enable you to translate this answer to German. I will give that a try in a few minutes to make sure my English is reasonably compatible with the translation algorithm. • Translation seems OK, except for subscripts in equations. Nov 16, 2019 at 8:56 • Thanks for your input - I made an edit to my question (which took quite some time). I still wonder, whether there is an intuitive argument concerning the type of the CI (The interval with "$-\infty$" or "$+\infty\$"?). But perhaps it is all about your point "one-sided CI don't provide what you are looking for". To your points: (1) Corrected now. (2) This was on purpose as I wanted to test with an example, where the result is really obvious. Do you have a reference for handling p-values near one? (3) Do you have a good reference for the use of one-sided CI? Nov 19, 2019 at 13:12
• Thanks for revision of your question (+1). Of four the references you found on this site, I think (2) will be the most useful. // Overall, I think it is best to build intuition based on 2-sided alternatives and confidence intervals first. In practice, it is best to do a 2-sided test unless you have advance knowledge (or strong opinion) which way results will fall. It is poor practice to decide on a one-sided hypothesis after you see experimental results. Nov 19, 2019 at 18:57
• Perhaps you have some good ideas for this issue? ;-) Nov 22, 2019 at 15:38