Good afternoon everybody,

I'm writing a little function to visualise hypothesis testing. Therefore I need to extract the confidence level of a t-test. Here a little example:

   x <- str(t.test(1:10)

gives

   List of 9
    $ statistic  : Named num 5.74
     ..- attr(*, "names")= chr "t"
    $ parameter  : Named num 9
     ..- attr(*, "names")= chr "df"
    $ p.value    : num 0.000278
    $ conf.int   : atomic [1:2] 3.33 7.67
     ..- attr(*, "conf.level")= num 0.95
    $ estimate   : Named num 5.5
     ..- attr(*, "names")= chr "mean of x"
    $ null.value : Named num 0
     ..- attr(*, "names")= chr "mean"
    $ alternative: chr "two.sided"
    $ method     : chr "One Sample t-test"
    $ data.name  : chr "1:10"
    - attr(*, "class")= chr "htest"

Now I can use

   x$conf.int

what gives

   [1] 496.9141 499.6276
   attr(,"conf.level")
   [1] 0.95

In the example I try to extract the value 0.95 but I have no Idea how. I hope somebody can help me.
Thanks in advance an greetings from Berlin

Etienne

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to