2

I am trying to comparing the means of two samples and here is the output of my t test:

>t.test(Hrs_female,Hrs_male, conf.level = 0.95, alternative = "greater")
Welch Two Sample t-test
data:  Hrs_female and Hrs_male
t = -0.20031, df = 57.848, p-value = 0.579
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
-0.93453      Inf
sample estimates:
mean of x mean of y 
3.966667  4.066667

How do I interpret such a 95% confidence interval with an upper bound of Inf? Does it mean my sample size is not large enough?

Thank you!

Joseph
  • 45
  • 1
  • 3

1 Answers1

2

You have set the argument alternative = "greater" for a one sided test. That is why either Inf or -Inf is the natural border, you requested. Here an example with a large number of cases:

> t.test(rnorm(20000), rnorm(20000), alternative = "less")

Welch Two Sample t-test

data:  rnorm(20000) and rnorm(20000)
t = -1.139, df = 39998, p-value =
0.1274
alternative hypothesis: true difference in means is less than 0
95 percent confidence interval:
       -Inf 0.00504815
sample estimates:
   mean of x    mean of y 
-0.008239926  0.003125650 

or, to demonstrate positive Inf:

> t.test(rnorm(20000), rnorm(20000), alternative = "greater")

Welch Two Sample t-test

data:  rnorm(20000) and rnorm(20000)
t = 1.368, df = 39998, p-value = 0.08565
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -0.002771267          Inf
sample estimates:
   mean of x    mean of y 
 0.008055759 -0.005638076 

So you see, large $n$ has nothing to do with it, only the one-sided test.

Bernhard
  • 7,419
  • 14
  • 36
  • I am trying to interpret what it means when you have either -Inf or Inf in the confidence interval. Not because the alternative is less or greater or two.sided. – Joseph Nov 24 '17 at 07:14
  • In a two sided alternative, you are basically asking, whether 0 is outside the confidence interval. In a one sided alternative, you ask, whether there is a 0 on one specific side of the confidence interval. It is therefore sensible, to construct a one sided confidence interval and extend the other side to plus or minus`$\infty$. – Bernhard Nov 24 '17 at 07:17
  • This is a two sample t test. So I am really not into the type of alternatives I am looking at. For now, I want to understand why the lower bound or upper bound is Inf. – Joseph Nov 24 '17 at 07:20
  • 1
    If you are not into the type of alternatives, then just call the `t.test` function with the standard alternative `"two.sided"` and the function will give you a confidence interval, that does not include `Inf`. – Bernhard Nov 24 '17 at 07:24