R-alpha: confidence interval of t.test

Friedrich Leisch Friedrich.Leisch@ci.tuwien.ac.at
Thu, 3 Jul 1997 18:42:55 +0200


Sorry if this has been discussed here before, but anyway:

The are differences between the confidence intervals of the t.test as
done by R and Splus:

*** R

R> x<-rnorm(1000)+1
R> t.text(x)
Error: couldn't find function "t.text"
R> t.test(x)

         One Sample t-test 

data:  x 
t = 31.4062, df = 999, p-value = 0 
alternative hypothesis: true mean is not equal to 0 
95 percent confidence interval:
 0.917027 1.039261 
sample estimates:
mean of x 
 0.978144 

R> t.test(x, mu=1)

         One Sample t-test 

data:  x 
t = -0.7017, df = 999, p-value = 0.483 
alternative hypothesis: true mean is not equal to 1 
95 percent confidence interval:
 -0.08297297  0.03926111                      <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
sample estimates:
mean of x 
 0.978144 



*** Splus

> x<-rnorm(1000)+1
> t.test(x)

         One-sample t-Test 

data:  x 
t = 28.6918, df = 999, p-value = 0 
alternative hypothesis: true mean is not equal to 0 
95 percent confidence interval:
 0.8975418 1.0293277 
sample estimates:
 mean of x 
 0.9634347

> t.test(x, mu=1)

         One-sample t-Test 

data:  x 
t = -1.0889, df = 999, p-value = 0.2764 
alternative hypothesis: true mean is not equal to 1 
95 percent confidence interval:
 0.8975418 1.0293277                    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
sample estimates:
 mean of x 
 0.9634347



*******************


As you can See R's confidence intervals are centered around the
deviation from the null, whereas those of Splus are centered around
the observed value ... the later seems the more intuitive thing to me.

So is this a bug or feature of R (in my eyes it's a bug)?


Best,
Fritz
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-