T Test Difference in Medians Sample Size Calculator

Plan median difference studies with practical power estimates. Enter assumptions, review outputs, and export results. Adjust inputs carefully for stronger sample planning decisions today.

Calculator Inputs

Formula Used

Median standard error is estimated as: SE(median) = c × SD / √n. For roughly normal data, c = 1.253314.

Difference standard error is: SE(diff) = √[c² × DE × (SD1² / n1 + SD2² / n2)].

With allocation ratio r = n2 / n1, the first group estimate is: n1 = [(critical + zpower)² × c² × DE × (SD1² + SD2² / r)] / Δ².

The second group is n2 = r × n1. Attrition adjustment is recruit n = analyzable n / retention.

How to Use This Calculator

  1. Enter the expected median for both independent groups.
  2. Enter the expected standard deviation for each group.
  3. Select alpha, power, test direction, and allocation ratio.
  4. Change the median SE factor when your data shape needs it.
  5. Add attrition, design effect, rounding, and minimum group rules.
  6. Press the calculate button and review the result above the form.
  7. Use CSV or PDF export to save the planning output.

Example Data Table

Scenario Median 1 Median 2 SD 1 SD 2 Power Alpha Use Case
Equal spread 50 44 12 12 80% 0.05 Balanced pilot planning
Unequal spread 72 65 18 14 90% 0.05 Higher certainty study
Unequal allocation 30 25 10 9 80% 0.025 More controls than cases

Understanding Median Difference Planning

Median outcomes are useful when data are skewed. Income, length of stay, reaction time, and biomarker values often behave this way. A mean may move because of a few extreme values. A median gives the middle value, so it can describe a typical subject better. This calculator helps plan two independent groups before data collection starts.

Why Sample Size Matters

A study with too few records may miss a real median difference. A study with too many records can waste time, money, and effort. Power planning balances these concerns. The tool uses the expected median gap, spread, confidence level, power, allocation ratio, and attrition rate. It then estimates how many participants are needed in each group.

Statistical Method

A true t test is designed for mean differences. Median testing usually uses rank methods or asymptotic median theory. This calculator uses a planning approximation for medians. It converts each standard deviation into a median standard error. For roughly normal data, the usual factor is 1.2533. You can edit that factor when your distribution is more or less variable near the center.

Inputs That Need Care

The expected median difference is the most sensitive input. Choose it from prior studies, pilot data, or a clinically meaningful target. Standard deviations should describe the expected variation in each group. The power value often uses 80 percent or 90 percent. The alpha value often uses 0.05 for two sided testing. A higher design effect increases the needed sample.

Reading the Output

The result table shows the analyzable sample size and the recruited sample size. Recruited size includes the attrition allowance. It also shows the estimated effect size, standard error, critical value, and approximate degrees of freedom. These checks help you see whether the plan is realistic. Export the result when you need a record for reports.

Best Practice

Use this output as an estimate, not as a final protocol decision. Median studies can depend strongly on the data shape. When possible, compare this estimate with a rank test, simulation, or specialist review. Save the assumptions with every result, because reviewers need clear details. Recheck them whenever the study question changes or data improve later. Good planning combines math with subject knowledge.

FAQs

1. Is this a true t test for medians?

No. A classic t test compares means. This tool uses a t style planning approximation for median differences by estimating the standard error of each median.

2. What does the median SE factor mean?

It adjusts the standard deviation into an estimated median standard error. For roughly normal data, 1.253314 is commonly used. Other distributions may need another factor.

3. What is the expected median difference?

It is the planned absolute gap between the two group medians. Use prior research, pilot data, or the smallest meaningful difference.

4. Why does higher power increase sample size?

Higher power lowers the chance of missing a real difference. That requires more information, so the required sample size increases.

5. What does allocation ratio mean?

It is group 2 size divided by group 1 size. A ratio of 1 gives equal groups. A ratio of 2 gives twice as many in group 2.

6. Why include attrition?

Attrition accounts for expected losses, exclusions, or incomplete records. The recruited sample is increased so enough analyzable participants remain.

7. What is design effect?

Design effect inflates sample size for clustering, repeated sampling, or complex design. Use 1 for a simple independent group study.

8. Should I use this for final protocol approval?

Use it as a planning estimate. For formal studies, confirm assumptions with a statistician, simulation, or a method designed for your exact median test.

Related Calculators

Paver Sand Bedding Calculator (depth-based)Paver Edge Restraint Length & Cost CalculatorPaver Sealer Quantity & Cost CalculatorExcavation Hauling Loads Calculator (truck loads)Soil Disposal Fee CalculatorSite Leveling Cost CalculatorCompaction Passes Time & Cost CalculatorPlate Compactor Rental Cost CalculatorGravel Volume Calculator (yards/tons)Gravel Weight Calculator (by material type)

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.