[R] how to interpret t.test output

Felipe Carrillo mazatlanmexico at yahoo.com
Sat Aug 9 23:51:27 CEST 2008


Hi Ted:
Thanks for your prompt reply and explanation. 
That's what I was wondering, why would one need to test mu=0 ,which is the t.test default. But reading Peter Dalgaard's book and looking at some examples online, I saw t.test being used like that; t.test(datasetname) with no other arguments.


> >     t.test(fishlength)
> >          One Sample t-test
> > 
> > data:  fishlength
> > t = 30.1741, df = 13, p-value = 2.017e-13
> > alternative hypothesis: true mean is not equal to 0
> > 95 percent confidence interval:
> >  36.14141 41.71573
> > sample estimates:
> > mean of x
> >  38.92857
> > 
> > Thanks in advance for your help.
> 
> In terms of interpreting a statistical test, using your
> data,
> of the hypothesis that the mean length in the population is
> 0,
> the P-value of 0.0000000000002017 is very strong evidence
> indeed
> that the mean is not 0.
> 
> However, I do not know why you are asking the question. No
> test
> is needed. The length of any living fish, even while it is
> still
> in the egg, is greater than 0; and whatever population you
> have
> taken your sample from will have a mean length which is
> greater
> than 0.
> 
> That is not to say that the result of a t-test on any
> sample
> will necessarily give a significant result. You could have
> a
> small catch with lengths, say,
> 
>    fishlengths <- c(2,4,9,20,50)
>    t.test(fishlengths,mu=0)
> 
> #         One Sample t-test
> # data:  fishlengths 
> # t = 1.9273, df = 4, p-value = 0.1262
> # alternative hypothesis: true mean is not equal to 0 
> # 95 percent confidence interval:
> #  -7.489442 41.489442 
> # sample estimates:
> # mean of x 
> #        17 
> 
> And all you can conlude from that is that the sample, *in
> itself*,
> does not carry sufficient information to confirm what you
> know
> is true (i.e. mu > 0). Even the one-sided test of mu=0
> with alternative
> alt="greater" does not give a result significant
> at 5%:
> 
>  t.test(fishlengths,mu=0,alt="greater")
> 
> #         One Sample t-test
> # data:  fishlengths 
> # t = 1.9273, df = 4, p-value = 0.0631
> # alternative hypothesis: true mean is greater than 0 
> # 95 percent confidence interval:
> #  -1.803807       Inf 
> # sample estimates:
> # mean of x 
> #        17 
> 
> Hoping this helps!
> Ted.



More information about the R-help mailing list