EVOLUTION-MANAGER
Edit File: mcnemar.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: McNemar's Chi-squared Test for Count Data</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 mcnemar.test {stats}"><tr><td>mcnemar.test {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>McNemar's Chi-squared Test for Count Data</h2> <h3>Description</h3> <p>Performs McNemar's chi-squared test for symmetry of rows and columns in a two-dimensional contingency table. </p> <h3>Usage</h3> <pre> mcnemar.test(x, y = NULL, correct = TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>either a two-dimensional contingency table in matrix form, or a factor object.</p> </td></tr> <tr valign="top"><td><code>y</code></td> <td> <p>a factor object; ignored if <code>x</code> is a matrix.</p> </td></tr> <tr valign="top"><td><code>correct</code></td> <td> <p>a logical indicating whether to apply continuity correction when computing the test statistic.</p> </td></tr> </table> <h3>Details</h3> <p>The null is that the probabilities of being classified into cells <code>[i,j]</code> and <code>[j,i]</code> are the same. </p> <p>If <code>x</code> is a matrix, it is taken as a two-dimensional contingency table, and hence its entries should be nonnegative integers. Otherwise, both <code>x</code> and <code>y</code> must be vectors or factors of the same length. Incomplete cases are removed, vectors are coerced into factors, and the contingency table is computed from these. </p> <p>Continuity correction is only used in the 2-by-2 case if <code>correct</code> is <code>TRUE</code>. </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 McNemar's 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>a character string indicating the type of test performed, and whether continuity correction was used.</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>References</h3> <p>Alan Agresti (1990). <em>Categorical data analysis</em>. New York: Wiley. Pages 350–354. </p> <h3>Examples</h3> <pre> ## Agresti (1990), p. 350. ## Presidential Approval Ratings. ## Approval of the President's performance in office in two surveys, ## one month apart, for a random sample of 1600 voting-age Americans. Performance <- matrix(c(794, 86, 150, 570), nrow = 2, dimnames = list("1st Survey" = c("Approve", "Disapprove"), "2nd Survey" = c("Approve", "Disapprove"))) Performance mcnemar.test(Performance) ## => significant change (in fact, drop) in approval ratings </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>