Sum of medians or median of sums I am estimating the total consumption of a community of species.
I have a dataset of total consumption for a given species based on population density and average energetic needs. This is related to body mass. I run a mixed effect MCMC model of logConsumption ~ logBodyMass, that includes phylogeny of the species as random effect. From this I have a posterior distribution of 1000 samples of consumption per species. Which I exponentiate to get the actual values and not the logged transformed values. Therefore the 1000 estimates for each species will be a right-skewed distribution.
From this dataset I want to calculate the total consumption for any given community of species. I have chosen to use the median instead of the mean since that is less affected by the skewed distributions.
For any given community I get different results if I:
Method 1: Estimate the median consumption per sample for the species list and then then sum them, or:
Method 2: Calculate the median consumption per species first, and then take the sum of medians for the particular species community.

*

*Is method 1 wrong?

*Is one method better than the other?

*What measure is the best to show uncertainty for the community. Standard deviation is not good when I use medians I assume?

*Should I have used means instead? Since then the order doesn't matter?

Code example below. Method 2 is always larger.
# A simple simulation of 1 cell, 10 species, and 100 samples of consumption
# Code in R

set.seed(42)

# Number of species
species <- 1:10

# For one grid cell simulate 100 consumptions per species (log-distributed)
consumption <- sapply(species, function(.) rlnorm(100, meanlog = log(.), sdlog = 1))
# 10 columns (1 for each species)
# 100 rows (1 for each sample of the right skewed distributions)

# METHOD 1:
# Calculate median species consumption across simulations
species.medians <- apply(consumption, 2, median)
# Find median consumption in cell
(total.consumption.1 <- sum(species.medians))
[1] 55.3787

# METHOD 2:
# Calculate total species consumption per cell per simulation
cell.sums <- apply(consumption, 1, sum)
# Find median consumption across all simulations
(total.consumption.2 <- median(cell.sums))
[1] 78.89258

# Increase: (New method will always produce a larger number)
(total.consumption.2 - total.consumption.1)/total.consumption.1*100
[1] 42.46014

 A: Sums and means are tied together by definition. The fact that a distribution is right-skewed does not undermine this.
The median is essentially useless for getting at totals unless a distribution is symmetric (and it might not be ideal even then). My monthly expenditure is skewed too, as every now and again there are spikes with large outgoings, but neither my bank manager nor my spouse would find the median informative for judging total flows.
There is a serious issue of resistance or robustness: estimates of totals are necessarily sensitive to outliers, just as are estimates of means, but medians don't solve this. It is more a matter of flagging sensitivity in your discussions, e.g. within a paper, report or thesis. You could show the effect of omitting a few large values, or indeed discuss how far you know which the largest values are and/or what difficulties arise in their measurement.
EDIT It would always be possible to report

*

*Totals based on means and totals based on medians so that readers can see the difference. There are intermediate cases, notably that means and medians are limiting cases of trimmed means.


*Bootstrap or jackknife indications of variability.
