EVOLUTION-MANAGER
Edit File: t.test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Student's t-Test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for t.test {stats}"><tr><td>t.test {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Student's t-Test</h2> <h3>Description</h3> <p>Performs one and two sample t-tests on vectors of data. </p> <h3>Usage</h3> <pre> t.test(x, ...) ## Default S3 method: t.test(x, y = NULL, alternative = c("two.sided", "less", "greater"), mu = 0, paired = FALSE, var.equal = FALSE, conf.level = 0.95, ...) ## S3 method for class 'formula' t.test(formula, data, subset, na.action, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a (non-empty) numeric vector of data values.</p> </td></tr> <tr valign="top"><td><code>y</code></td> <td> <p>an optional (non-empty) numeric vector of data values.</p> </td></tr> <tr valign="top"><td><code>alternative</code></td> <td> <p>a character string specifying the alternative hypothesis, must be one of <code>"two.sided"</code> (default), <code>"greater"</code> or <code>"less"</code>. You can specify just the initial letter.</p> </td></tr> <tr valign="top"><td><code>mu</code></td> <td> <p>a number indicating the true value of the mean (or difference in means if you are performing a two sample test).</p> </td></tr> <tr valign="top"><td><code>paired</code></td> <td> <p>a logical indicating whether you want a paired t-test.</p> </td></tr> <tr valign="top"><td><code>var.equal</code></td> <td> <p>a logical variable indicating whether to treat the two variances as being equal. If <code>TRUE</code> then the pooled variance is used to estimate the variance otherwise the Welch (or Satterthwaite) approximation to the degrees of freedom is used.</p> </td></tr> <tr valign="top"><td><code>conf.level</code></td> <td> <p>confidence level of the interval.</p> </td></tr> <tr valign="top"><td><code>formula</code></td> <td> <p>a formula of the form <code>lhs ~ rhs</code> where <code>lhs</code> is a numeric variable giving the data values and <code>rhs</code> a factor with two levels giving the corresponding groups.</p> </td></tr> <tr valign="top"><td><code>data</code></td> <td> <p>an optional matrix or data frame (or similar: see <code><a href="model.frame.html">model.frame</a></code>) containing the variables in the formula <code>formula</code>. By default the variables are taken from <code>environment(formula)</code>.</p> </td></tr> <tr valign="top"><td><code>subset</code></td> <td> <p>an optional vector specifying a subset of observations to be used.</p> </td></tr> <tr valign="top"><td><code>na.action</code></td> <td> <p>a function which indicates what should happen when the data contain <code>NA</code>s. Defaults to <code>getOption("na.action")</code>.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>further arguments to be passed to or from methods.</p> </td></tr> </table> <h3>Details</h3> <p>The formula interface is only applicable for the 2-sample tests. </p> <p><code>alternative = "greater"</code> is the alternative that <code>x</code> has a larger mean than <code>y</code>. </p> <p>If <code>paired</code> is <code>TRUE</code> then both <code>x</code> and <code>y</code> must be specified and they must be the same length. Missing values are silently removed (in pairs if <code>paired</code> is <code>TRUE</code>). If <code>var.equal</code> is <code>TRUE</code> then the pooled estimate of the variance is used. By default, if <code>var.equal</code> is <code>FALSE</code> then the variance is estimated separately for both groups and the Welch modification to the degrees of freedom is used. </p> <p>If the input data are effectively constant (compared to the larger of the two means) an error is generated. </p> <h3>Value</h3> <p>A list with class <code>"htest"</code> containing the following components: </p> <table summary="R valueblock"> <tr valign="top"><td><code>statistic</code></td> <td> <p>the value of the t-statistic.</p> </td></tr> <tr valign="top"><td><code>parameter</code></td> <td> <p>the degrees of freedom for the t-statistic.</p> </td></tr> <tr valign="top"><td><code>p.value</code></td> <td> <p>the p-value for the test.</p> </td></tr> <tr valign="top"><td><code>conf.int</code></td> <td> <p>a confidence interval for the mean appropriate to the specified alternative hypothesis.</p> </td></tr> <tr valign="top"><td><code>estimate</code></td> <td> <p>the estimated mean or difference in means depending on whether it was a one-sample test or a two-sample test.</p> </td></tr> <tr valign="top"><td><code>null.value</code></td> <td> <p>the specified hypothesized value of the mean or mean difference depending on whether it was a one-sample test or a two-sample test.</p> </td></tr> <tr valign="top"><td><code>stderr</code></td> <td> <p>the standard error of the mean (difference), used as denominator in the t-statistic formula.</p> </td></tr> <tr valign="top"><td><code>alternative</code></td> <td> <p>a character string describing the alternative hypothesis.</p> </td></tr> <tr valign="top"><td><code>method</code></td> <td> <p>a character string indicating what type of t-test was performed.</p> </td></tr> <tr valign="top"><td><code>data.name</code></td> <td> <p>a character string giving the name(s) of the data.</p> </td></tr> </table> <h3>See Also</h3> <p><code><a href="prop.test.html">prop.test</a></code> </p> <h3>Examples</h3> <pre> require(graphics) t.test(1:10, y = c(7:20)) # P = .00001855 t.test(1:10, y = c(7:20, 200)) # P = .1245 -- NOT significant anymore ## Classical example: Student's sleep data plot(extra ~ group, data = sleep) ## Traditional interface with(sleep, t.test(extra[group == 1], extra[group == 2])) ## Formula interface t.test(extra ~ group, data = sleep) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>