EVOLUTION-MANAGER
Edit File: bartlett.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: Bartlett Test of Homogeneity of Variances</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 bartlett.test {stats}"><tr><td>bartlett.test {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Bartlett Test of Homogeneity of Variances</h2> <h3>Description</h3> <p>Performs Bartlett's test of the null that the variances in each of the groups (samples) are the same. </p> <h3>Usage</h3> <pre> bartlett.test(x, ...) ## Default S3 method: bartlett.test(x, g, ...) ## S3 method for class 'formula' bartlett.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 numeric vector of data values, or a list of numeric data vectors representing the respective samples, or fitted linear model objects (inheriting from class <code>"lm"</code>).</p> </td></tr> <tr valign="top"><td><code>g</code></td> <td> <p>a vector or factor object giving the group for the corresponding elements of <code>x</code>. Ignored if <code>x</code> is a list.</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> gives the data values and <code>rhs</code> 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>If <code>x</code> is a list, its elements are taken as the samples or fitted linear models to be compared for homogeneity of variances. In this case, the elements must either all be numeric data vectors or fitted linear model objects, <code>g</code> is ignored, and one can simply use <code>bartlett.test(x)</code> to perform the test. If the samples are not yet contained in a list, use <code>bartlett.test(list(x, ...))</code>. </p> <p>Otherwise, <code>x</code> must be a numeric data vector, and <code>g</code> must be a vector or factor object of the same length as <code>x</code> giving the group for the corresponding elements of <code>x</code>. </p> <h3>Value</h3> <p>A list of class <code>"htest"</code> containing the following components: </p> <table summary="R valueblock"> <tr valign="top"><td><code>statistic</code></td> <td> <p>Bartlett's K-squared test statistic.</p> </td></tr> <tr valign="top"><td><code>parameter</code></td> <td> <p>the degrees of freedom of the approximate chi-squared distribution of the test statistic.</p> </td></tr> <tr valign="top"><td><code>p.value</code></td> <td> <p>the p-value of the test.</p> </td></tr> <tr valign="top"><td><code>method</code></td> <td> <p>the character string <code>"Bartlett test of homogeneity of variances"</code>.</p> </td></tr> <tr valign="top"><td><code>data.name</code></td> <td> <p>a character string giving the names of the data.</p> </td></tr> </table> <h3>References</h3> <p>Bartlett, M. S. (1937). Properties of sufficiency and statistical tests. <em>Proceedings of the Royal Society of London Series A</em> <b>160</b>, 268–282. doi: <a href="https://doi.org/10.1098/rspa.1937.0109">10.1098/rspa.1937.0109</a>. </p> <h3>See Also</h3> <p><code><a href="var.test.html">var.test</a></code> for the special case of comparing variances in two samples from normal distributions; <code><a href="fligner.test.html">fligner.test</a></code> for a rank-based (nonparametric) <i>k</i>-sample test for homogeneity of variances; <code><a href="ansari.test.html">ansari.test</a></code> and <code><a href="mood.test.html">mood.test</a></code> for two rank based two-sample tests for difference in scale. </p> <h3>Examples</h3> <pre> require(graphics) plot(count ~ spray, data = InsectSprays) bartlett.test(InsectSprays$count, InsectSprays$spray) bartlett.test(count ~ spray, data = InsectSprays) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>