# one sample t-test ${\rm H_0}:\mu=1$ vs ${\rm H_0}:\mu<1$

Suppose I want to test \begin{align} &{\rm H_0}: \mu = 1,\notag\\ &{\rm H_A}: \mu < 1, \end{align} and I get a p-value of 0.3, meaning I don't reject the null for the alternative.

In this post

One sided test $H_0:\mu=0$ or $H_0:\mu\leq 0$?

can write this test this way: \begin{align} {\rm H_0}: \mu < 1,\notag\\ \end{align} I think the p-value for this test is just 1 minus the p-value of the above test, so I get a p-value of $$0.7$$. However I am a little confused about the interpretation. A p-value of 0.7 (>0.05) means that we don't reject the null. But the null here is $$\mu < 1$$. It seems to me that this contradicts my previous conclusion.

Can anyone help me explain this? Thanks!

• Maybe $H_0:μ\ge1,$ but not $H_0:μ>1,$ The null hypothesis determines the null distribution of the test. So $H_0$ must have an $=$-sign in order precisely to specify the null distribution. // The rest of your question is not at all clear. If you are asking what sample size is necessary in order to reject $H_0:μ\ge1$ in favor of $H_a:μ<1$, then (a) you need to specify the exact value $μ_a<1$ (maybe you have $μ_a=0.5$ in mind), (b) the variance $σ^2$ of the normal population distribution, and (c) the power of the test (that is, the probability of rejection). Commented Jan 10, 2021 at 19:08
• Also, be careful to distinguish between null hypothesis $H_0$ and alternative hypothesis $H_a.$ Commented Jan 10, 2021 at 19:23
• Thanks so much for your comment. I guess my first question is that what's the relationship between the p-value of test1 and test2? with test1 being H0: mu=1; Ha:mu<1 and test2 being H0: mu<=1; Ha:mu>1. Is It p-value for test1 = 1-p-value for test2? Commented Jan 10, 2021 at 19:26
• You seem to be totally on the right track with this comment. See the Addendum to my Answer for an example. Commented Jan 10, 2021 at 22:02

In this post, we'll write down rejection regions associated with both tests in OP's question. We'll show that the rejection regions for both tests do not partition space: it's possible that the realized data is in neither rejection region, leading to no rejections at all.

## The model

Suppose that $$X_i \stackrel{\textrm{ind}}{\sim} \mathcal{N}(\mu, 1)$$ are independent draws from a normal distribution with common mean and variance. For convenience, we'll assume that the variance is known and so we're working with a $$Z$$ test rather than a $$t$$ test.

## Getting the rejection regions

In this section, we will write down the rejection regions for both of the tests defined below. The displayed equations are the only important parts. Notationally, we use "primes" on all quantities associated with the second test.

For the first hypothesis test

\begin{align*} H_0: \mu = 1 \\ H_1: \mu < 1 \end{align*}

an optimal rejection region is given by $$R=\{\bar{X} < c\}$$ for some rejection cutoff $$c$$. Whenever the sample mean is small, we reject the null hypothesis $$H_0$$ and conclude that $$\mu < 1$$. If we wish the rejection region $$R$$ to have an $$\alpha$$ type I error rate, then we can choose the cutoff so that: $$R_\alpha = \{\bar{X} < 1+\frac{\Phi^{-1}(\alpha)}{\sqrt{n}}\},$$ where $$\Phi$$ is the standard normal distribution function. Note, we found this rejection region $$R_\alpha$$ by solving for $$\mathbb{P}_{\mu=0} \left[ \bar{X} \in R_\alpha \right] = \alpha.$$

For the second hypothesis test

\begin{align*} H_0': \mu < 1 \\ H_1': \mu = 1 \end{align*}

an optimal rejection region is given by $$R'=\{\bar{X} > c'\}$$ for some rejection cutoff $$c'$$. Whenever the sample mean is large, we reject the null hypothesis $$H_0'$$ and conclude that $$\mu = 1$$. If we wish the rejection region $$R'$$ to have an $$\alpha$$ type I error rate, then we can choose the cutoff so that: $${R'}_\alpha = \{\bar{X} > 1-\frac{\Phi^{-1}(\alpha)}{\sqrt{n}}\},$$ where $$\Phi$$ is the standard normal distribution function. Note, we found this rejection region $${R'}_\alpha$$ by solving for $$\sup_{\mu < 1} \mathbb{P}_{\mu} \left[ \bar{X} \in {R'}_\alpha \right] = \alpha.$$

## Interpreting the rejection regions

Here's where we are now: by writing down the rejection regions, we've found the sample means which would lead us to reject either test. Now we will interpret the tests for a particular choice of the sample size $$n$$ and the chosen Type I error rate $$\alpha$$.

Suppose that $$\alpha = 0.05$$ and $$n = 100$$. Then $$R_{0.05} = \{\bar{X} < 0.8355\}$$ and $${R'}_{0.05} = \{ \bar{X} > 1.1645 \}.$$ Therefore, when the sample mean is smaller than $$0.8355$$, we would reject $$H_0$$ and conclude that $$H_1$$ is true, i.e. $$\mu < 1$$. Further, when the sample mean is larger than $$1.1645$$, we would reject $$H_0'$$ and conclude that $$H_1'$$ is true, i.e. $$\mu=1$$.

What happens if $$\bar{X}$$ is not "small" or "large"? In this case, neither $$H_0$$ nor $$H_0'$$ would be rejected, and we cannot conclude anything from these particular tests. One way to make some conclusion would be making $$\alpha$$ larger until one of the tests reject---then concluding the alternative of that test. In some sense, this is choosing the "most likely" parameter region. This would correspond to choosing the alternative of the test with the smallest $$p$$ value.

• Excellent explanation! Commented Jan 12, 2021 at 1:47

Comment continued with sample size computations from Minitab statistical software. Testing $$H_0: \mu = 1$$ vs. specific alternative $$H_a: \mu = 0.5,$$ with data from a population with $$\sigma^2 = 1.$$

Power and Sample Size

1-Sample t Test

Testing mean = null (versus < null)
Calculating power for mean = null + difference
α = 0.05  Assumed standard deviation = 1

Sample  Target
Difference    Size   Power  Actual Power
-0.5      27    0.80      0.811832
-0.5      36    0.90      0.902575
-0.5      45    0.95      0.951240


So, for example, if you want the probability of rejection to be $$0.9$$ (power 90%) in these circumstances, you would need a sample of size $$n = 36.$$

Addendum per Comment: Suppose you have $$n = 40$$ observations from a population distributed as $$\mathsf{Norm}(\mu = 10.2, \sigma = 1),$$ as follows:

set.seed(121)
x = rnorm(40, 10.2, 1)
summary(x);  sd(x)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
8.731   9.655  10.318  10.268  10.861  11.815
[1] 0.8135376


The stripchart below shows the $$n=40$$ observations. The dotted red line is at $$\mu_0 = 10$$ and the solid black line is at $$\bar X = 10.268.$$

R code for figure:

stripchart(x, pch="|")
abline(v = 10, col="red", lwd=2, lty="dotted")
abline(v = mean(x), lwd=2)


First, consider $$H_0: \mu \le 10,$$ vs $$H_a: \mu > 10.$$ Because $$\bar X = 10.268,$$ we may have evidence that $$\bar X$$ is significantly greater than $$10,$$ rejecting $$H_0$$ in favor of $$H_a.$$ In R, a one-sample t test gives the following results:

t.test(x, mu = 10, alte = "greater")

One Sample t-test

data:  x
t = 2.0809, df = 39, p-value = 0.02203
alternative hypothesis: true mean is greater than 10
95 percent confidence interval:
10.05094      Inf
sample estimates:
mean of x
10.26767


It turns out that $$\bar X = 10.318$$ is significantly larger than $$10$$ at the 5% level of significance because the P-value $$= 0.02203 < 0.05 = 5\%.$$

By contrast, for the same data, suppose we want to test $$H_0: \mu \ge 10,$$ against $$H_a: \mu < 10.$$ Because $$\bar X = 10.268,$$ we have no evidence that $$H_a < 10.$$ If this is the hypothesis we had planned to test before collecting data, we might go ahead with the formality of a t test, but we already know we cannot reject $$H_0$$ in favor of $$H_a.$$

t.test(x, mu = 10, alt="less")
One Sample t-test

data:  x
t = 2.0809, df = 39, p-value = 0.978
alternative hypothesis: true mean is less than 10
95 percent confidence interval:
-Inf 10.48439
sample estimates:
mean of x
10.26767


The P-value is greater than 5%, so we can't reject $$H_0$$ at the 5% level. In particular, as you suspected, the P-value of this test looking in the "wrong" tail is $$1$$ minus the P-value for the previous t test (looking in the "correct" tail): $$0.022 + 0.978 = 1.$$

Note: A two-sided test of $$H_0: \mu=10$$ against $$H_a: \mu \ne 10$$ has P=value $$= 0.044 = 2(0.022),$$ where $$0.022$$ is the P-value of the first one-sided t test (the one looking in the "correct" tail).

t.test(x, mu=10)\$p.val
[1] 0.04406042