[R] why doesn't t.test value include standard error

Paul Johnson pauljohn32 at gmail.com
Fri May 8 04:39:30 CEST 2009


Hello, everybody!

I'm back to ask the obvious on behalf of the silent majority :)

Today a student asked me "what standard error was used in this t.test
output".  I looked into it and was a little surprised that a t.test
output object does not have a "slot" for the standard error.  Of
course, we can reconstruct the se=mu-hat/t, but I was surprised.

Do you think it would be nicer if t.test did include the denominator
in the output? If we had that output, we could more easily compare the
different methods of calculating the standard error that are discussed
in ?t.test.

ex:

> x <- rnorm(100, m=10)
> myt <- t.test(x, m=8)
> attributes(myt)
$names
[1] "statistic"   "parameter"   "p.value"     "conf.int"    "estimate"
[6] "null.value"  "alternative" "method"      "data.name"

$class
[1] "htest"

> myse <- myt$estimate/myt$statistic
> myse
mean of x
0.4928852
> myt$statistic
       t
20.33975
> myt$estimate/myse
mean of x
 20.33975


Happy summer!  Today was our last day of class in Kansas.

-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas



More information about the R-help mailing list