Content translation/zh

[[File:Cx-screenshot-aug-2017.png|thumb|400x400px|McNemar's test From Wikipedia, the free encyclopedia

This article may be too technical for most readers to understand. Please help improve it to make it understandable to non-experts, without removing the technical details. (November 2012) (Learn how and when to remove this template message) In statistics, McNemar's test is a statistical test used on paired nominal data. It is applied to 2 × 2 contingency tables with a dichotomous trait, with matched pairs of subjects, to determine whether the row and column marginal frequencies are equal (that is, whether there is "marginal homogeneity"). It is named after Quinn McNemar, who introduced it in 1947.[1] An application of the test in genetics is the transmission disequilibrium test for detecting linkage disequilibrium.[2]

Contents [hide] 1	Definition 1.1	Variations 2	Examples 3	Discussion 3.1	Information in the pairings 4	Related tests 5	See also 6	References 7	External links Definition[edit] The test is applied to a 2 × 2 contingency table, which tabulates the outcomes of two tests on a sample of n subjects, as follows.

Test 2 positive	Test 2 negative	Row total Test 1 positive	a	b	a + b Test 1 negative	c	d	c + d Column total	a + c	b + d	n The null hypothesis of marginal homogeneity states that the two marginal probabilities for each outcome are the same, i.e. pa + pb = pa + pc and pc + pd = pb + pd.

Thus the null and alternative hypotheses are[1]

H 0

p b = p c H 1

p b ≠ p c {\begin{aligned}H_{0}&:~p_{b}=p_{c}\\H_{1}&:~p_{b}\neq p_{c}\end{aligned}} Here pa, etc., denote the theoretical probability of occurrences in cells with the corresponding label.

The McNemar test statistic is:

χ 2 = ( b − c ) 2 b + c . \chi ^{2}={(b-c)^{2} \over b+c}. Under the null hypothesis, with a sufficiently large number of discordants (cells b and c), χ 2 \chi ^{2} has a chi-squared distribution with 1 degree of freedom. If the χ 2 \chi ^{2} result is significant, this provides sufficient evidence to reject the null hypothesis, in favour of the alternative hypothesis that pb ≠ pc, which would mean that the marginal proportions are significantly different from each other.

Variations[edit] If either b or c is small (b + c < 25) then χ 2 \chi ^{2} is not well-approximated by the chi-squared distribution.[citation needed] An exact binomial test can then be used, where b is compared to a binomial distribution with size parameter n = b + c and p = 0.5. Effectively, the exact binomial test evaluates the imbalance in the discordants b and c. To achieve a two-sided P-value, the P-value of the extreme tail should be multiplied by 2:

exact-P-value = 2 ∑ i = b n ( n i ) 0.5 i ( 1 − 0.5 ) n − i {\displaystyle {\text{exact-P-value}}=2\sum _{i=b}^{n}{n \choose i}0.5^{i}(1-0.5)^{n-i}} which is simply twice the binomial distribution cumulative distribution function with p = 0.5 and n = b + c.

Edwards [3] proposed the following continuity corrected version of the McNemar test to approximate the binomial exact-P-value:

χ 2 = ( b − c − 1 ) 2 b + c . \chi ^{2}={(|b-c|-1)^{2} \over b+c}. The mid-P McNemar test (mid-p binomial test) is calculated by subtracting half the probability of the observed b from the exact one-sided P-value, then double it to obtain the two-sided mid-P-value:[4][5]

mid-p-value = 2 ( ∑ i = b n ( n i ) 0.5 i ( 1 − 0.5 ) n − i − 0.5 ( n b ) 0.5 b ( 1 − 0.5 ) n − b ) {\displaystyle {\text{mid-p-value}}=2\left(\sum _{i=b}^{n}{n \choose i}0.5^{i}(1-0.5)^{n-i}-0.5{n \choose b}0.5^{b}(1-0.5)^{n-b}\right)} This is equivalent to:

mid-p-value = exact-p-value − ( n b ) 0.5 b ( 1 − 0.5 ) n − b {\displaystyle {\text{mid-p-value}}={\text{exact-p-value}}-{n \choose b}0.5^{b}(1-0.5)^{n-b}} where the second term is the binomial distribution probability mass function and n = b + c. Fortunately, binomial distribution functions are readily available in common software packages and the McNemar mid-P test can easily be calculated.[5]

The traditional advice has been to use the exact binomial test when b + c < 25. However, simulations have shown both the exact binomial test and the McNemar test with continuity correction to be overly conservative.[5] When b + c < 6, the exact-P-value always exceeds the common significance level 0.05. The original McNemar test was most powerful, but often slightly liberal. The mid-P version was almost as powerful as the asymptotic McNemar test and was not found to exceed the nominal significance level.

Examples[edit] In the first example, a researcher attempts to determine if a drug has an effect on a particular disease. Counts of individuals are given in the table, with the diagnosis (disease: present or absent) before treatment given in the rows, and the diagnosis after treatment in the columns. The test requires the same subjects to be included in the before-and-after measurements (matched pairs).

After: present	After: absent	Row total Before: present	101	121	222 Before: absent	59	33	92 Column total	160	154	314 In this example, the null hypothesis of "marginal homogeneity" would mean there was no effect of the treatment. From the above data, the McNemar test statistic:

χ 2 = ( 121 − 59 ) 2 121 + 59 \chi ^{2}={(121-59)^{2} \over {121+59}} has the value 21.35, which is extremely unlikely to form the distribution implied by the null hypothesis (P < 0.001). Thus the test provides strong evidence to reject the null hypothesis of no treatment effect.

A second example illustrates differences between the asymptotic McNemar test and alternatives.[5] The data table is formatted as before, with different numbers in the cells:

After: present	After: absent	Row total Before: present	59	6	65 Before: absent	16	80	96 Column total	75	86	161 With these data, the sample size (161 patients) is not small, however results from the McNemar test and other versions are different. The exact binomial test gives P = 0.053 and McNemar's test with continuity correction gives χ 2 \chi ^{2} = 3.68 and P = 0.055. The asymptotic McNemar's test gives χ 2 \chi ^{2} = 4.55 and P = 0.033 and the mid-P McNemar's test gives P = 0.035. Both the McNemar's test and mid-P version provide stronger evidence for a statistically significant treatment effect in this second example.

Discussion[edit] An interesting observation when interpreting McNemar's test is that the elements of the main diagonal do not contribute to the decision about whether (in the above example) pre- or post-treatment condition is more favourable. Thus, the sum b + c can be small and statistical power of the tests described above can be low even though the number of pairs a + b + c + d is large (see second example above).

An extension of McNemar's test exists in situations where independence does not necessarily hold between the pairs; instead, there are clusters of paired data where the pairs in a cluster may not be independent, but independence holds between different clusters.[6] An example is analyzing the effectiveness of a dental procedure; in this case, a pair corresponds to the treatment of an individual tooth in patients who might have multiple teeth treated; the effectiveness of treatment of two teeth in the same patient is not likely to be independent, but the treatment of two teeth in different patients is more likely to be independent.[7]

Information in the pairings[edit] John Rice wrote:[8]

85 Hodgkin's patients [...] had a sibling of the same sex who was free of the disease and whose age was within 5 years of the patient's. These investigators presented the following table:

Tonsillectomy No tonsillectomy Hodgkins 41	44	Control 33	52{\begin{array}{c|c|c}\hline &{\text{Tonsillectomy}}&{\text{No tonsillectomy}}\\\hline {\text{Hodgkins}}&41&44\\\hline {\text{Control}}&33&52\end{array}} They calculated a chi-squared statistic [...] [they] had made an error in their analysis by ignoring the pairings.[...] [their] samples were not independent, because the siblings were paired [...] we set up a table that exhibits the pairings:

Sibling Patient No tonsillectomy Tonsillectomy No tonsillectomy 37	7	Tonsillectomy 15	26{\begin{array}{cc}&{\text{Sibling}}\\{\text{Patient}}&{\begin{array}{c|c|c}\hline &{\text{No tonsillectomy}}&{\text{Tonsillectomy}}\\\hline {\text{No tonsillectomy}}&37&7\\\hline {\text{Tonsillectomy}}&15&26\end{array}}\end{array}} It is to the second table that McNemar's test can be applied. Notice that the sum of the numbers in the second table is 85—the number of pairs of siblings—whereas the sum of the numbers in the first table is twice as big, 170—the number of individuals. The second table gives more information than the first. The numbers in the first table can be found by using the numbers in the second table, but not vice versa. The numbers in the first table give only the marginal totals of the numbers in the second table.

Related tests[edit] The binomial sign test gives an exact test for the McNemar's test. The Cochran's Q test is an extension of the McNemar's test for more than two "treatments". The Liddell's exact test is an exact alternative to McNemar's test.[9][10] The Stuart–Maxwell test is different generalization of the McNemar test, used for testing marginal homogeneity in a square table with more than two rows/columns.[11][12][13] The Bhapkar's test (1966) is a more powerful alternative to the Stuart–Maxwell test,[14][15] but it tends to be liberal. Competitive alternatives to the extant methods are available.[16] The McNemar’s test is a special case of the Cochran–Mantel–Haenszel test; it is equivalent to a CMH test with one stratum for the each of the N pairs and, in each stratum, a 2x2 table showing the paired binary responses.[17] See also[edit] Pearson's chi-squared test Chi-squared distribution References[edit] ^ Jump up to: a b McNemar, Quinn (June 18, 1947). "Note on the sampling error of the difference between correlated proportions or percentages". Psychometrika. 12 (2): 153–157. doi:10.1007/BF02295996. PMID 20254758. Jump up ^ Spielman RS; McGinnis RE; Ewens WJ (Mar 1993). "Transmission test for linkage disequilibrium: the insulin gene region and insulin-dependent diabetes mellitus (IDDM)". Am J Hum Genet. 52 (3): 506–16. PMC 1682161 Freely accessible. PMID 8447318. Jump up ^ Edwards, A (1948). "Note on the "correction for continuity" in testing the significance of the difference between correlated proportions". Psychometrika. 13: 185–187. doi:10.1007/bf02289261. Jump up ^ Lancaster, H.O. (1961). "Significance tests in discrete distributions". J AmStat Assoc. 56: 223–234. doi:10.1080/01621459.1961.10482105. ^ Jump up to: a b c d Fagerland, M.W.; Lydersen, S.; Laake, P. (2013). "The McNemar test for binary matched-pairs data: mid-p and asymptotic are better than exact conditional". BMC Medical Research Methodology. 13: 91. doi:10.1186/1471-2288-13-91. Jump up ^ Yang, Z.; Sun, X.; Hardin, J.W. (2010). "A note on the tests for clustered matched-pair binary data". Biometrical Journal. 52 (5): 638–652. doi:10.1002/bimj.201000035. PMID 20976694. Jump up ^ Durkalski, V.L.; Palesch, Y.Y.; Lipsitz, S.R.; Rust, P.F. (2003). "Analysis of clustered matched-pair data". Statistics in medicine. 22 (15): 2417–28. doi:10.1002/sim.1438. PMID 12872299. Retrieved April 1, 2009. Jump up ^ Rice, John (1995). Mathematical Statistics and Data Analysis (Second ed.). Belmont, California: Duxbury Press. pp. 492–494. ISBN 0-534-20934-3. Jump up ^ Liddell, D. (1976). "Practical Tests of 2 × 2 Contingency Tables". Journal of the Royal Statistical Society. 25 (4): 295–304. JSTOR 2988087. Jump up ^ "Maxwell's test, McNemar's test, Kappa test". Rimarcik.com. Retrieved 2012-11-22. Jump up ^ Sun, Xuezheng; Yang, Zhao (2008). "Generalized McNemar's Test for Homogeneity of the Marginal Distributions" (PDF). SAS Global Forum. Jump up ^ Stuart, Alan (1955). "A Test for Homogeneity of the Marginal Distributions in a Two-Way Classification". Biometrika Trust. JSTOR 2333387. Jump up ^ Maxwell, A.E. (1970). "Comparing the Classification of Subjects by Two Independent Judges" (PDF). The British Journal of Psychiatry. Jump up ^ "McNemar Tests of Marginal Homogeneity". John-uebersax.com. 2006-08-30. Retrieved 2012-11-22. Jump up ^ Bhapkar, V.P. (1966). "A Note on the Equivalence of Two Test Criteria for Hypotheses in Categorical Data". American Statistical Association. JSTOR 2283057. Jump up ^ Yang, Z.; Sun, X.; Hardin, J.W. (2012). "Testing Marginal Homogeneity in Matched-Pair Polytomous Data". Therapeutic Innovation & Regulatory Science. 46 (4): 434–438. doi:10.1177/0092861512442021. Jump up ^ Agresti, Alan (2002). Categorical Data Analysis (PDF). Hooken, New Jersey: John Wiley & Sons, Inc. p. 413. ISBN 0-471-36093-7. External links[edit] Vassar College's McNemar 2×2 Grid McNemar Tests of Marginal Homogeneity [hide] v t e Statistics Outline Index [show] Descriptive statistics [show] Data collection [show] Statistical inference [show] Correlation Regression analysis [hide] Categorical / Multivariate / Time-series / Survival analysis Categorical Cohen's kappa Contingency table Graphical model Log-linear model McNemar's test Multivariate Regression Manova Principal components Canonical correlation Discriminant analysis Cluster analysis Classification Structural equation model Factor analysis Multivariate distributions Elliptical distributions Normal Time-series General Decomposition Trend Stationarity Seasonal adjustment Exponential smoothing Cointegration Structural break Granger causality Specific tests Dickey–Fuller Johansen Q-statistic (Ljung–Box) Durbin–Watson Breusch–Godfrey Time domain Autocorrelation (ACF) partial (PACF) Cross-correlation (XCF) ARMA model ARIMA model (Box–Jenkins) Autoregressive conditional heteroskedasticity (ARCH) Vector autoregression (VAR) Frequency domain Spectral density estimation Fourier analysis Wavelet Whittle likelihood Survival Survival function Kaplan–Meier estimator (product limit) Proportional hazards models Accelerated failure time (AFT) model First hitting time Hazard function Nelson–Aalen estimator Test Log-rank test [show] Applications CategoryCategory PortalPortal Commons pageCommons WikiProject WikiProject Categories: Statistical testsNonparametric statisticsSummary statistics for contingency tables Navigation menu Not logged inTalkContributionsCreate accountLog inArticleTalkReadEditView historySearch

Main page Contents Featured content Current events Random article Donate to Wikipedia Wikipedia store Interaction Help About Wikipedia Community portal Recent changes Contact page Tools What links here Related changes Upload file Special pages Permanent link Page information Wikidata item Cite this page Print/export Create a book Download as PDF Printable version

Languages Deutsch Euskara فارسی Français Italiano Polski Português Suomi Edit links This page was last edited on 1 March 2018, at 23:02. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization. Privacy policyAbout WikipediaDisclaimersContact WikipediaDevelopersCookie statementMobile viewEnable previews Wikimedia Foundation Powered by MediaWiki 内容翻译工具显示有关来源中的链接和翻译条目的信息. ]]

内容翻译工具可以让维基百科编辑直接对照着原文翻译条目，还可以自动进行一些无聊的步骤：将原文本复制过去、寻找在另一语言版本维基百科上的相应的链接和分类等等. 通过这些更流畅的体验，译者们可以将时间省下来，用于创建高质量的、更加可读的翻译内容.

目前该工具仍在开发之中，但您已经可以试用；已经有上千篇条目使用这个工具创建成功，这提高了翻译的效率. 内容翻译集成词典或机器翻译服务等工具. 虽然并非所有语言都支持，但该工具可以扩展以支持更多.

内容翻译补充了现有的翻译扩展：当维基百科菜单或其他一些用户界面文字被翻译、同步时，维基百科的内容可以使用内容翻译工具来翻译.

试用此工具
您可以访问任意语言版本的维基百科的Special:ContentTranslation页面以使用此工具. 第一次访问将在您的设置中自动启用该工具.

内容翻译工具目前作为测试功能提供，在所有语言版本的维基百科中对所有已登录用户开放. 启用该功能后您会看到，您可以轻松地从您的“贡献”页进入内容翻译工具，或从维基百科条目左栏的语言列表进行一个新的内容翻译项目.

如果您对该工具有任何问题，或者您想分享使用该工具的经验，请在讨论页反馈.

该工具的目的
内容翻译工具允许您创建一个基于已经存在的外语文章维基百科页面的初步（翻译）版本. 这个工具的重点是把一个已经存在的外语文章的内容传达与改编为另一种语言. 它允许编辑者重复使用尽可能多或尽可能少的内容编辑他们的初步版本，以来在以后用他们常用的编辑工具来继续编辑它.

我们期望内容翻译会帮助人类的知识扩展到更多的语言. 这个工具面向知道两种及以上语言的用户

对于当前的编者们，此工具将会简化翻译内容的过程. 目前，大约15%的用户也用一种第二语言编辑. 这些多语种的用户被认为是比单语种的同行更多产，平均比单语种的同行多约2.3倍的编辑.

除此以外，比起重头创建新页面，这个工具会吸引新的编者，使用这种工具会让新编者做出贡献更为容易.

该工具根据以下原则设计：


 * 节约时间：帮助翻译者快速创建内容无需使用另外的工具进行不必要的复制与粘贴.
 * 提供帮助：阻止错误，让用户对他们的翻译更为自信.
 * 提高翻译质量：这一工具让维基计划的内容交流更为合适，翻译目的更为合理以及会帮助用户避免坏的翻译.
 * 不强迫用户：因为不同的翻译者也会遵循不同的翻译模式，这一工具不会打扰翻译过程.
 * 集中精力在内容上：翻译应更关注内容而不是文本样式. 技术要素比如维基源代码能使用这一方法处理而不会让翻译更难.

您可参见更多考虑与分析.

如何参与

 * 试用该工具
 * 您可以自愿参加我们的测试会议. 自从我们基于我们正在计划能够继续的语言选择参加者，我们会用一些时间您联系. 无论如何，我们对测试尽可能多的用户感兴趣，我们将感谢您的参与.
 * 在现有工具的支持下，使用你能提供信息的新语言调查翻译为您的语言.
 * 在讨论页提供反馈.

相关页面

 * 工具定义
 * 开发者相关
 * 配置详情
 * 帮助文档
 * 公告
 * 所有子页面