# Median Uncertainty propagation

I have a data set of values each with a different associated error. If I take the mean, I can use standard error propagation to calculate a much smaller error. This will therefore incorporate the individual uncertainties of each data point.

However, is there a method to propagate the individual uncertainties when taking the median? If I take the standard deviation this only provides a measure of the data spread and not the individual instrumental errors.

I have tried adding the standard deviation and the uncertainty on the actual median value in quadrature. However, as this only takes in to account one data points' uncertainty this is high and so my total error does not get reduced.

Is there a way to propagate these errors when taking the median?

What you could do is to represent each data-point by a normal distribution and using the uncertainty of the data points as standard deviation of that distribution. Using a simple simulation, you could verify that this improves the result. Here is my simple example:

I generated $$N=50$$ fake data points $$\{y_1, \ldots, y_{50}\}$$ around the value 100, and used the deviance of the target value as the standard deviation of that data point $$\{sd_1, \ldots, sd_{50}\}$$ -- I additionally used some noise. The $$y_i$$ represent the measured values and the $$sd_i$$ the associated uncertainty. The dataset looks like this:

Calculating the standard median value of this dataset yields $$Median[y] \approx 99.37$$ I estimate the 95% confidence interval of the median by using bootstrapping to be $$CI_{95\%} = [97.08, 101.83]$$

Next, I represented each "measured value" $$y_i$$ by a distribution -- this is similar to using bootstrapping with unequal probabilities for picking each value. To keep it simple, I simulate $$n_{sim}=100$$ random values $$\{r^{(i)}_1, \ldots r^{(i)}_{100}\}$$ for each "measured" data point $$y_i$$. These random values are drawn from the normal distribution, $$r^{(i)} \sim N(\mu=y_i, \sigma = sd_i)$$ -- note that I use the measured value and it's uncertainty as input parameters. This results in a much narrower peak around the true median value, as can be seen in the following plot:

Calculating the median value of this dataset yields $$Median[r] \approx 99.91$$ The bootstrap 95% confidence interval is given by $$CI_{95\%} = [99.81, 100.04]$$ Both are much closer to the true value.

The "standard error propagation techniques" are based on the assumption that your measurements are drawn from normal (that is, Gaussian) distributions, for which the mean and the median are the same. If your means and medians are substantially different, and you are serious about your uncertainty propagation, you'll want to have models for your individual, non-Gaussian uncertainties. You'll then propagate those distributions through your analysis to find a final uncertainty distribution.

This is how you end up with e.g. asymmetric error bars.