1
$\begingroup$

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.

  1. Is method 1 wrong?
  2. Is one method better than the other?
  3. What measure is the best to show uncertainty for the community. Standard deviation is not good when I use medians I assume?
  4. 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
$\endgroup$
7
  • 2
    $\begingroup$ They are not the same. Could you tell use more on what exactly are you trying to achieve? What is your data? What is the research question? $\endgroup$
    – Tim
    Jan 9, 2023 at 13:33
  • $\begingroup$ I read that. But I am still not sure what the correct method is. I am leaning towards method 2. I have data on animal biomass consumption per species (a posterior distribution with 1000 samples), and I have different species assemblages. I want to calculate the total community consumption. $\endgroup$ Jan 9, 2023 at 13:40
  • $\begingroup$ For a more detailed answer, you'd need to give us more details about your research, as stated above. Please edit the question for the details. $\endgroup$
    – Tim
    Jan 9, 2023 at 13:46
  • $\begingroup$ I though I just did that? What kind of details do you need? $\endgroup$ Jan 9, 2023 at 13:50
  • 1
    $\begingroup$ What do you know about the distribution of the data? How was it gathered? Is there any dependence between the species? ... etc. The more details you can give, the more relevant answer you can get. $\endgroup$
    – Tim
    Jan 9, 2023 at 13:53

1 Answer 1

2
$\begingroup$

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

  1. 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.

  2. Bootstrap or jackknife indications of variability.

$\endgroup$
7
  • $\begingroup$ So to understand you correctly. You think it is a mistake to use the median either before or after, and we should use the mean in this case. For clarification of the issue I have also added a bit more context in an edit of the question. $\endgroup$ Jan 9, 2023 at 15:23
  • $\begingroup$ In short. yes. Consider your own results. I am guessing that your means are much bigger than your medians, which is common (not absolutely universal though) for right-skewed distributions. $\endgroup$
    – Nick Cox
    Jan 9, 2023 at 15:26
  • $\begingroup$ Yes about 10-30 % higher. $\endgroup$ Jan 9, 2023 at 15:49
  • $\begingroup$ The problem is that medians are not affected by the transformation from log scale to normal scale. While means are - therefore I think medians are a more fair option. Further if the medians of the distribution is not affected by the uncertainty of the estimate - while the mean certainly will increase with a larger spread on the log scale. $\endgroup$ Jan 11, 2023 at 12:55
  • 2
    $\begingroup$ @RasmusØ.Pedersen Maybe you can think of it like this: If you have an empirical distribution of consumptions of unknown shape, the total consumption is the sum. The sum is n times the mean, but you can't reconstruct the sum from the median. The advantage of the median is its robustness to extreme values, however this is only an advantage if the extreme values are in fact wrong. If they are correct, they contribute to the sum in a way you should be interested in, and this is reflected by the mean, and ignored by the median. $\endgroup$ Jan 13, 2023 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.