# How to visualize data averaged over ranks?

I have data from twelve experiments, with seven days and five animals on each. Based on the seven day mean of each animal's data, it is a assigned a rank from 1 to 5. I would like to combine the data from all experiments, so I could visualize the time progression of the rank 1 data, rank 2 data, etc.

It's easy to just take the mean of the data for all animals from each rank. The problem is that it might be misleading - even if the data were random, a winner will still emerge and taking the mean of all winners will 'smooth' the curve so to speak, resulting in a specious appearance of a hierarchy. Is there a way to combine such data without misleading, and without simply overlaying the plots?

• Why it is useful or helpful to plot ranks in the first place? What's wrong with looking at the original measurements? Apr 7, 2016 at 9:01
• There are too many of them. If we present all off them together, there is too much data to make sense of, visually speaking. Apr 7, 2016 at 9:14
• Sorry, don't understand. I imagine as many ranks as measurements. Apr 7, 2016 at 9:15
• No, there are five ranks in each experiment. Each rank is determined by the seven day average of each animal. So on any particular day the rank 1 animal can go below rank 2, for example, as long as on average its numbers are higher. Apr 7, 2016 at 9:16
• Still unclear to me. If you are plotting each animal as a curve, calling one animal rank 3 or whatever makes no difference to the number of measurements. Why not post your data (12 x 7 x 5 is a small dataset by modern standards). You may have several variables, but unless you tell us otherwise, you are not combining variables too, so posting data for one variable of interest should illuminate the problem. Otherwise I fear that what you are asking is unclear. Apr 7, 2016 at 9:20

This isn't in any sense a complete answer, but it certainly won't fit in a comment.

Thanks for posting sample data [EDIT: now removed from the OP], which makes it easier to think about the question. The spreadsheet posted has no text labels, but given the word description the data structure seems clear. The last variable (column) was created for the purposes of my own software.

Three key points:

1. Much depends on the biological or medical details, not given, but rank has no obvious meaning beyond being identified for each experiment. If there were, as it were, some kind of pecking order which emerges during the experiment, then that is different, but in the absence of other information the animals are taken to be independent of each other.

2. I'd certainly be queasy about taking the first animal in each experiment and combining them when they are different animals, and similarly for other ranks. As you say, there will be just be inevitable consequences that the average of the highest is likely to be the highest of the averages, and so forth.

3. As far as visualization is concerned, I don't see that there is an inherent difficulty in plotting the raw data as time series. Example below. That little structure is evident in the data is a different problem, but I can't comment given no knowledge of what you are expecting or hypothesising. I can't imagine that using ranks directly or indirectly would help here.

EDIT Stacked bars. I've not tried to make this look good. A small merit of this design is that if you look carefully you can see leakage on a few days.

• The data for each day from each experiment are dependent, so if one subject's numbers go up from day 1 to day 2, the other subjects' numbers go down on average, such that the sums for each day are constant. The hypothesis is that the subjects form a pecking order (I don't need assistance with the statistics of this, though, only the visualization). Apr 7, 2016 at 13:25
• I din't spot that. Note some discrepancies especially exp 1 day 6, exp 2 day 5, exp 3 day 6, exp 5 day 4 which seem to show "leakage" of some kind. If these are really shares of a total, then some people would stack area bands. Not keen personally, but it's common. Apr 7, 2016 at 13:33
• Can you please show an example? Apr 7, 2016 at 13:39
• I did. I chose stacked bars. I think these plots are oversold, but there you go. Apr 7, 2016 at 14:07
• Aha. So is there a way to use these stacked bars to obtain a mean from all experiments? Or is there really no other choice besides putting the experiments side-by-side or choosing an example one? Apr 7, 2016 at 14:11