R: Student's t-test

t_test {bain} | R Documentation

## Student's t-test

### Description

This function is a wrapper for the function `t.test`, which returns group-specific sample sizes and variances, in addition to the usual output of `t.test`.

### Usage

    t_test(x, ...)

### Arguments

`x` | An object for which an S3 method of t.test exists (vector or formula).
`...` | arguments passed to `t.test`.

### Details

This wrapper allows users to enjoy the functionality of bain with the familiar interface of the stats-function t.test.

For more documentation, see `t.test`.

### Value

A list with class `"t_test"` containing the following components:

`statistic` | the value of the t-statistic.
`parameter` | the degrees of freedom for the t-statistic.
`p.value` | the p-value for the test.
`conf.int` | a confidence interval for the mean appropriate to the specified alternative hypothesis.
`estimate` | the estimated mean or difference in means depending on whether it was a one-sample test or a two-sample test.
`null.value` | the specified hypothesized value of the mean or mean difference depending on whether it was a one-sample test or a two-sample test.
`alternative` | a character string describing the alternative hypothesis.
`method` | a character string indicating what type of t-test was performed.
`data.name` | a character string giving the name(s) of the data.
`v` | The variance or group-specific variances.
`n` | The sample size, or group-specific sample size.

### See Also

`t.test`

### Examples

    tmp <- t_test(extra ~ group, data = sleep)
    tmp$n
    tmp$v
    tmp2 <- t_test(extra ~ group, data = sleep)
    tmp2$n
    tmp2$v
    tmp <- t_test(extra ~ group, data = sleep, paired = TRUE)
    tmp$n
    tmp$v
    tmp2 <- t_test(extra ~ group, data = sleep, paired = TRUE)
    tmp2$n
    tmp2$v
    t_test(sesamesim$postnumb)
    tmp <- t_test(sesamesim$prenumb)
    tmp$n
    tmp$v
    tmp2 <- t_test(sesamesim$prenumb)
    tmp2$n
    tmp2$v
    tmp <- t_test(sesamesim$prenumb, sesamesim$postnumb)
    tmp$n
    tmp$v
    tmp2 <- t_test(sesamesim$prenumb, sesamesim$postnumb)
    tmp2$n
    tmp2$v
    tmp <- t_test(sesamesim$prenumb, sesamesim$postnumb, paired = TRUE)
    tmp$n
    tmp$v
    tmp2 <- t_test(sesamesim$prenumb, sesamesim$postnumb, paired = TRUE)
    tmp2$n
    tmp2$v

[Package bain version 0.2.7 Index]