# I have a p-value of nearly 1, but my t-statistic is in the rejection interval

I am given two sets of data: price0 and price1, both normally distributed. We denote the means of both sets $$\mu_0$$ and $$\mu_1$$ respectively. The question asked is:
"For which values of $$a$$ can we reject $$H_0$$ for the following hypothesis test:
$$H_0 : \mu_0 \geq \mu_1 - a$$
$$H_1 : \mu_0 < \mu_1 -a$$
on a significance level of $$\alpha = 0.05$$?
I did this analyticly first and found:
$$t = \dfrac{\mu_0-(\mu_1-a)}{\frac{s_0}{\sqrt{n}}} \leq t_{n-1,1-\alpha}$$, for $$t \in (-\inf, -t_{n-1,1-\alpha}]$$, the rejection interval.
Note that in the equation above, $$s_0$$ is sample standard deviation of price0, $$n$$ is the total number of elements in price0 and $$t_{n-1,1-\alpha}$$ is the t-distribution with $$n-1$$ degrees of freedom and $$1-\alpha$$ is the percentile. Hence,
$$a \leq - \frac{s_0}{\sqrt{n}}\cdot t_{n-1,1-\alpha} - \mu_0 + \mu_1$$.
Untill now all is well (for me at least). But when I use t.test() in R ('a' in the code below is the numeric value found by the above inequality):

t.test(price0, mu = mean(price1) - a, alternative = 'g', conf.level = 0.95)

The output with all the numeric values is:

One Sample t-test

data:  prijs0
t = -4.6165, df = 22, p-value = 0.9999
alternative hypothesis: true mean is greater than 1074.273
95 percent confidence interval:
886.2384      Inf
sample estimates:
mean of x
937.2174

I am also confused by the output:

alternative hypothesis: true mean is greater than 1074.273

Since I would think my nullhypothesis is: "true mean is greater than 1074.273" (because 1074.273 = mean(price0) - a).
Anyway my t-value is such that it would be an element of the rejection interval, which would mean we would discard $$H_0$$. But meanwhile my p-value is nearly 1, which means we cannot discard $$H_0$$, nor can we say anything about whether $$H_0$$ is true or not.
My question now is, am I doing anything wrong in my code or is it my way of thinking about these types of hypothesis tests?

• Do you have sample mean, variance (or standard deviation or standard error) and sample size for price0 and price1 (6 numbers)? Dec 6, 2018 at 2:47
• I have the sample mean, - variance and - size of both price0 and price1. I do not have the true mean nor the true variance. Dec 6, 2018 at 8:11

Then you have made a mistake. The main error here is using alternative = 'g' when you should have used alternative = 'l'. Your alternative hypothesis is that the true mean is less than some specified value. (The other problem is that you have done a one-sample test which takes the true mean $$\mu_1$$ to be equivalent to the sample mean $$\bar{x}_2$$. This has the effect of removing the uncertainty in the true mean of the second population. If you want to account for the uncertainty in both means the you should be doing a two-sample test.)