# Averaging Histograms

I am currently running experiments which include measuring concentrations throughout an environment, producing a histogram as such:

Which shows the percentage of positions which have oxygen concentrations between 0 and 10%, 10% and 20% etc.

I am running the experiment multiple times, and would like to know what is the proper way of "averaging" results or if the idea of averaging just doesn't make sense.

I can think of two options:

1) Taking the average value of each bin across all experiments (but then my percentages wouldn't add to 100%...)

2) Summing the values of each bin across all experiments, and calculating the percentage in terms of total samples across all bins across experiments.

Is any of the two options sensible?

Edits from comments:

Sample sizes could be different between experiments

• Are your sample sizes unequal across multiple experiments? Commented Sep 13, 2018 at 10:55
• I can't guarantee they're the same. It's an agent-based model so there could be different numbers of cells.
– MrD
Commented Sep 13, 2018 at 10:56
• Be careful not to fall into the XY-problem; Is a histogram the desired result or is there another underlying question you want to answer? If it is, why can't you concatenate all three experiments and make one histogram of their combined original data? If there is reason to assume the measurements within the three experiments are correlated, this seems like a clear example to me of something you should model with mixed model (using a random effect for experiment). Commented Sep 13, 2018 at 12:59
• Late to this party, but percentage is wrong as on your vertical axis. What is shown is a proportion or fraction adding to 1. Percentages add to 100. Commented Apr 2 at 16:00
• Augmenting @Nick Cox's comment: the label on the vertical axis and the range on the horizontal axis (negative concentrations, anyone?) both indicate this is a bar chart rather than a histogram and further suggest analyzing the actual data rather than these derived statistics.
– whuber
Commented Apr 2 at 16:54

## 1 Answer

Why do you want to do this? The simplest way would be to make a common dataset of all the experiments, and then the need disappears. But of course, there are use cases, like not having the original data, but only histograms printed in papers.

We assume standard histograms representing relative frequency as area, so the total area of each histogram is 1. We can look at this as an estimator of an underlying density function. That gives away the solution, the combined density is a mixture density. Say the density functions for experiment 1,2,3 (say) is $$f_1, f_2, f_3$$, then (assuming equal sample numbers in each experiment) is $$\frac{f_1+f_2+f_3}{3}$$. Simply do the same with the histograms (or density estimates) $$\hat{f}_1, \hat{f}_2, \hat{f}_3$$, giving the averaged histogram $$\frac{\hat{f}_1+\hat{f}_2+\hat{f}_3}{3}$$. If the sample numbers are different, substitute weighted means.

This corresponds to your option 1), and I don't understand your claim there that then percentages will not sum to 100%. But the formulation above has the advantage that it does not need the histograms being constructed with the same bins.