Cal11 calculator

How to Calculate Confidence Interval for Median

Reviewed by Calculator Editorial Team

The confidence interval for the median is a range of values that is likely to contain the true population median with a specified level of confidence. This guide explains how to calculate it using the bootstrap method, which is particularly useful when the sample size is small or the data is not normally distributed.

What is a Confidence Interval for Median?

The confidence interval for the median provides a range of values within which we can be confident that the true population median lies. For example, a 95% confidence interval for the median income might be $45,000 to $60,000, meaning we are 95% confident that the true median income falls within this range.

Unlike the confidence interval for the mean, which requires normality assumptions, the confidence interval for the median can be calculated using non-parametric methods, making it more robust for skewed or non-normal data.

How to Calculate Confidence Interval for Median

The most common method for calculating the confidence interval for the median is the bootstrap method. Here's a step-by-step guide:

  1. Collect your data: Gather your sample data points.
  2. Sort the data: Arrange the data in ascending order.
  3. Determine the sample median: Find the middle value of your sorted data.
  4. Bootstrap sampling: Resample your data with replacement many times (typically 1,000 to 10,000 times) to create many bootstrap samples.
  5. Calculate bootstrap medians: For each bootstrap sample, calculate the median.
  6. Sort bootstrap medians: Arrange all the bootstrap medians in ascending order.
  7. Determine confidence interval: Find the lower and upper percentiles of the bootstrap medians that correspond to your desired confidence level.

Formula: The confidence interval for the median is calculated as:

Lower bound = (1 - α/2) × 100th percentile of bootstrap medians

Upper bound = α/2 × 100th percentile of bootstrap medians

Where α is the significance level (e.g., 0.05 for 95% confidence).

The bootstrap method is particularly useful because it does not rely on assumptions about the underlying distribution of the data. It works well for small sample sizes and non-normal data.

Worked Example

Let's calculate the 95% confidence interval for the median of the following sample data: 12, 15, 18, 20, 22, 25, 28, 30, 32, 35.

  1. Sort the data: The data is already sorted.
  2. Determine the sample median: The median is the average of the 5th and 6th values: (22 + 25)/2 = 23.5.
  3. Bootstrap sampling: Create 10,000 bootstrap samples by resampling the data with replacement.
  4. Calculate bootstrap medians: For each bootstrap sample, calculate the median.
  5. Sort bootstrap medians: Arrange all the bootstrap medians in ascending order.
  6. Determine confidence interval: For a 95% confidence interval, find the 2.5th and 97.5th percentiles of the bootstrap medians. Suppose these values are 19.2 and 27.8, respectively.

The 95% confidence interval for the median is (19.2, 27.8). This means we are 95% confident that the true population median lies between 19.2 and 27.8.

Interpreting the Results

When interpreting the confidence interval for the median, keep these points in mind:

  • Confidence level: The confidence level (e.g., 95%) indicates the probability that the interval contains the true population median. It is not the probability that the median falls within the interval.
  • Sample size: Larger sample sizes generally result in narrower confidence intervals, providing more precise estimates of the population median.
  • Data distribution: The bootstrap method works well for non-normal and skewed data, making it a robust choice for a wide range of datasets.

Note: The confidence interval for the median is not the same as the confidence interval for the mean. The median is less affected by extreme values and skewed data, making it a more robust measure of central tendency in such cases.

FAQ

What is the difference between the confidence interval for the median and the confidence interval for the mean?

The confidence interval for the median is calculated using non-parametric methods and is less affected by extreme values and skewed data. The confidence interval for the mean, on the other hand, typically requires normality assumptions and is more sensitive to outliers.

Can I calculate the confidence interval for the median without using the bootstrap method?

Yes, you can use the normal approximation method, but it requires assumptions about the data distribution and is less robust for non-normal or skewed data. The bootstrap method is generally preferred for its flexibility and accuracy.

How does sample size affect the confidence interval for the median?

Larger sample sizes generally result in narrower confidence intervals, providing more precise estimates of the population median. Smaller sample sizes may lead to wider intervals, indicating greater uncertainty in the estimate.