対応のある名義データの比率変化を検定します。二値アウトカムの前後研究やマッチドペアデザインに使用されます。
The McNemar test is a non-parametric statistical test used to analyze paired binary data—situations where the same subjects are measured twice on a dichotomous outcome. Developed by Quinn McNemar in 1947, it determines whether the proportion of subjects who changed from one category to another is significantly different from what would be expected by chance. It is essentially a test of symmetry in a 2×2 contingency table for matched pairs.
Use the McNemar test when you have paired or matched binary data. Common scenarios include: comparing a diagnostic test result before and after treatment, evaluating whether a training program changes pass/fail rates, testing if an intervention changes behavior (yes/no), or comparing two diagnostic methods applied to the same patients. The test focuses exclusively on the discordant pairs—subjects who changed their response between the two measurements.
| Feature | McNemar | Chi-Square | Cochran's Q |
|---|---|---|---|
| Data type | Paired binary | Independent categorical | Paired binary (≥3 timepoints) |
| Samples | Matched pairs | Independent | Matched (3+ measures) |
| Groups compared | 2 (before/after) | 2 or more | 3 or more |
| Focuses on | Discordant pairs | All cells | Changes across conditions |
A researcher tests whether a training program changes employee certification pass rates. 100 employees take the certification exam before and after training.
| After: Pass | After: Fail | Total | |
|---|---|---|---|
| Before: Pass | 40 | 12 | 52 |
| Before: Fail | 5 | 43 | 48 |
| Total | 45 | 55 | 100 |
The discordant pairs are b = 12 (passed before, failed after) and c = 5 (failed before, passed after). Since b + c = 17 < 25, the exact binomial test is used.
Results
McNemar's exact test, p = .143
There was no statistically significant change in pass rates after the training program. While 5 employees improved and 12 worsened, this difference was not significant at the .05 level.
The McNemar test requires the following assumptions to be met:
1. Paired/Matched Binary Data
Each subject must be measured twice (e.g., before and after), and the outcome must be binary (e.g., yes/no, pass/fail, positive/ negative). The data form a 2×2 table of matched pairs.
2. Mutually Exclusive Categories
Each subject must fall into exactly one of the four cells of the 2×2 table. The categories must be exhaustive and mutually exclusive at each time point.
3. Random Sampling
Subjects should be randomly selected from the population of interest, or randomly assigned to conditions. The matched pairs should be independent of each other (one pair's outcome should not influence another pair's outcome).
The standard McNemar test uses a chi-square statistic with one degree of freedom. Because the binomial distribution (which underlies the test) is discrete, a continuity correction of 1 is applied: χ² = (|b − c| − 1)² / (b + c). This correction makes the chi-square approximation more accurate for moderate sample sizes. For small samples (discordant pairs < 25), StatMate automatically uses the exact binomial test instead, which does not require any approximation.
Report the test statistic, degrees of freedom, and p-value. If the exact test was used, note this in the report:
Asymptotic Test Template
McNemar's test indicated [a significant/no significant] change in [outcome] from [time 1] to [time 2], χ²(1) = X.XX, p = .XXX.
Exact Test Template
McNemar's exact test indicated [a significant/no significant] change in [outcome] from [time 1] to [time 2], p = .XXX.
Note: Use the exact test when the total number of discordant pairs (b + c) is less than 25. Report p-values to three decimal places, using p < .001 when below that threshold. Include descriptive statistics about the discordant pairs.
StatMate's McNemar test calculations have been validated against R's mcnemar.test() function and SPSS output. The implementation uses the continuity- corrected chi-square statistic and the jstat library for probability distributions. For small samples (discordant pairs < 25), the exact two-tailed binomial test is used. All results match R output to at least 4 decimal places.
t検定
2群の平均値を比較
分散分析
3群以上の平均値を比較
カイ二乗検定
カテゴリ変数の関連を検定
相関分析
関係の強さを測定
記述統計
データを要約
サンプルサイズ
検出力分析・標本計画
1標本t検定
既知の値との比較
マン・ホイットニーU
ノンパラメトリック群間比較
ウィルコクソン検定
ノンパラメトリック対応検定
回帰分析
X-Yの関係をモデル化
重回帰分析
複数の予測変数
クロンバックのα
尺度の信頼性
ロジスティック回帰
二値アウトカムの予測
因子分析
潜在因子構造の探索
クラスカル・ウォリス
ノンパラメトリック3群以上比較
反復測定
被験者内分散分析
二元配置分散分析
要因計画の分析
フリードマン検定
ノンパラメトリック反復測定
フィッシャーの正確検定
2×2表の正確検定
mcnemar.discordantHint
データを入力して「計算」をクリックしてください
または「サンプルデータを読み込む」をクリックしてお試しください