2
$\begingroup$

I have independent 2 samples (both with $n = 200$) and i want to show that the true mean of sample b is higher than the true mean of sample a i.e. $H_0 : \mu_B \le \mu_A$ and $H1: \mu_B \gt \mu_A$.

I wanted to conduct a two sample t-test but since the true mean and variance are unknown i did a F-Test beforehand. The results of the F-Test were, that $\sigma^2_A = \sigma^2_B$.

Because of that i ran the aforementioned t-test in R with following parameters:

t.test(B,A, alternative="greater", var.equal = TRUE, paired=FALSE, conf.level=0.95) 
output:
           Two Sample t-test
data:  B and A
t = 0.33934, df = 398, p-value = 0.3673
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -1062.14      Inf
sample estimates:
mean of x mean of y 
 8545.895  8270.625 

I calculated the test-value by hand and had the same result for t. The means of A and B are correct too, but i dont understand the confidence interval. As far as i know the critical value for a right sided test is $t_{398;0.95} = 1.649$ and because of that id keep the null hypothesis since $t = 0.3393 \ngtr 1.649$. But if i were to follow the confidence interval in R id have to reject it, which seems odd.

$\endgroup$
2
$\begingroup$

Just to add to/expand on @abstrusiosity's answer:

  1. As mentioned above, 0 falls between -1062.14 and Inf - so if you were using the confidence interval to make null hypothesis testing decisions you would fail to reject the null in this case. (assuming the null is that the difference is not different from 0).
  2. The Inf is a result of your one-sided test. You don't really care about the upper bound of the CI in a > one-sided test - just that the lower bound is above 0. You get the same behavior with one-sided tests in the opposite direction. If you run the code below, you'll get -Inf on the lower bound of the interval when the directionality of the test is reversed.
A <- rnorm(100)
B <- rnorm(100)
t.test(A, B, alternative = 'less', var.equal = TRUE, paired = FALSE, conf.level = .95)
  1. If you want the symmetrical 95% CI you can run the code below. This CI would map on to a two-sided p-value.
# I've omitted `alternative` as the default is "two-sided"
t.test(A, B, var.equal = TRUE, paired = FALSE, conf.level = .95)

You can change the interval to .90 to get the LB or UB relevant for your directional hypothesis and get a symmetrical confidence interval around the mean difference.

$\endgroup$
2
  • $\begingroup$ Okey thank you, apparently there are many different options, my problem seemed to be interpreting the output correctly $\endgroup$ – Anil K. Dec 22 '20 at 17:53
  • $\begingroup$ No problem and no worries. It can be tricky to marry the technical coding with the interpretations - especially when the default outputs don't always perfectly align with what you are looking for. $\endgroup$ – Matt Barstead Dec 22 '20 at 17:56
3
$\begingroup$

The result from R says you don't reject the null.

The result gives you the confidence interval of the difference. It says $-1062.14 \lt \mu_B-\mu_A \lt \infty$. That means $\mu_B$ could be less than $\mu_A$ and so you cannot reject the null hypothesis.

$\endgroup$
2
  • $\begingroup$ So my results aren't opposite at all ? I think i kinda got you but its not quite intuitve for me; is there any way to output the critical value or another way to see that the null hypothesis is not being rejected ? Edit: So does -1062.14 mean that its a possible outcome for the difference and thus $\mu_A > \mu_B$ ? $\endgroup$ – Anil K. Dec 22 '20 at 17:39
  • $\begingroup$ This is a one-sided confidence interval bounded on the low end, and that bound is less than zero. That means the data is consistent with $\mu_A \gt \mu_B$ and also $\mu_A \lt \mu_B$. No clear answer about which is bigger. $\endgroup$ – abstrusiosity Dec 22 '20 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.