This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/t.test.html
t.test {base}R Documentation

Student's t-Test

Description

t.test performs one and two sample t-tests on vectors of data. If paired is TRUE then both x and y must be specified and they must be the same length. Missing values are removed (in pairs if paired is TRUE). If var.equal is TRUE then the pooled estimate of the variance is used. If var.equal is FALSE then the variance is estimated separately for both groups and the Welch modification to the degrees of freedom is used.

Usage

t.test(x, y = NULL, alternative = "two.sided", mu = 0, paired = FALSE,
       var.equal = FALSE, conf.level = 0.95)

Arguments

x

a numeric vector of data values.

y

an optional numeric vector data values.

alternative

must be one of "two.sided", "greater" or "less". You can specify just the initial letter. This parameter indicates the alternative hypothesis.

mu

a number indicating the true value of the mean (or difference in means if you are performing a two sample test).

paired

a logical indicating whether you want a paired t-test.

var.equal

a logical variable indicating whether to treat the two variances as being equal. If TRUE then the pooled variance is used to estimate the variance otherwise the Welch approximation to the degrees of freedom is used.

conf.level

confidence level of the interval.

Value

A list with class "htest" containing the following components:

statistic

the value of the t-statistic.

parameters

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.


[Package base version 0.60 ]