2
$\begingroup$

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!

$\endgroup$
2
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ 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. $\endgroup$
    – Joseph
    Nov 24 '17 at 7:14
  • $\begingroup$ 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$. $\endgroup$
    – Bernhard
    Nov 24 '17 at 7:17
  • $\begingroup$ 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. $\endgroup$
    – Joseph
    Nov 24 '17 at 7:20
  • 1
    $\begingroup$ 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. $\endgroup$
    – Bernhard
    Nov 24 '17 at 7:24

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.