Permutation Test for a Difference in Medians
The permutation test for a difference in medians compares the observed difference between two group medians with the differences obtained when group labels are reassigned at random, giving a p-value without assuming any distribution.
중앙값 차이 순열검정은 두 집단 중앙값의 실제 차이를 집단 이름표를 무작위로 다시 붙였을 때 얻는 차이들과 비교해 분포 가정 없이 p값을 구하는 방법이다.
Do two groups differ in their medians when the data are skewed or contain outliers?
자료가 치우쳐 있거나 이상값이 있을 때 두 집단의 중앙값이 다른지 어떻게 검정하나요?
Under the null hypothesis that both groups come from the same distribution, every reassignment of labels is equally likely. Counting how often a reassigned median difference is at least as extreme as the observed one gives an exact p-value in small samples and a Monte Carlo p-value otherwise.
When to use Permutation Test for a Difference in Medians
- You want to compare the medians of two independent groups.
- Data are skewed, heavy-tailed or contain outliers.
- Samples are small and you want an exact p-value.
When to use something else
- You want to compare means by permutation: use Permutation Test for Two Groups.
- You want a rank test of a general shift: use Mann-Whitney U Test.
- You want an estimate of the shift with a confidence interval: use Hodges-Lehmann Shift Estimate for Two Samples.
Assumptions and requirements
- Observations are independent.
- Under the null the two distributions are identical (exchangeable labels); with very different spreads the test is not a pure test of medians.
What the analysis reports
- Group medians and their difference
- Exact or Monte Carlo permutation p-value
- Number of relabellings and Monte Carlo standard error
How to report it
The median was [value] in group 1 and [value] in group 2 (difference = [value]); a permutation test with [value] relabellings gave p = [value].
Related methods
- Permutation Test for Two Groups
- Mood's Median Test
- Mann-Whitney U Test
- Hodges-Lehmann Shift Estimate for Two Samples
How this method is validated
이 방법의 검증 근거
- Independent computation. 1 reference test compares the results with SciPy and direct computations (formulas, enumeration or simulation).
독립 계산. SciPy·직접 계산(식·열거·모의실험) 대조 참조 시험 1건 통과.
Tolerances are relative differences (absolute differences for values near zero). R comparisons and reference tests are re-run before each release of the analysis engine.
허용오차는 상대 차이입니다(0 근처 값은 절대 차이). R 대조와 참조 시험은 분석 엔진을 배포할 때마다 다시 돌립니다.
Run Permutation Test for a Difference in Medians on Quorant
- Data you need
- a table (CSV or Excel) with an outcome variable and a grouping variable
- Price
- 250 credits for one analysis up to 10,000 rows (complexity level 2); larger or wider data costs more. Optional methodologist review: 1200 credits.
- Checking
- Compared with independent computations
- Before you pay
- A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.