3
$\begingroup$

Let us say a market's prices are distributed with a skew.

Given a sample of 10000 products, I can estimate the median, arithmetic mean and weighted average or any other statistic.

Let us say I draw 100 products from this distribution, what would be their total expected/average value? I cannot use arithmetic mean * 100 or can I? Should I use median * 100? Or should one use 100 * weighted average?

I am sorry I am still confused about this, despite reading lots of related posts here and elsewhere. Any clarification would be very much appreciated please. Thanks!

PS:

Given Dave's answer and code below, I tried to simulate my situation. Basically I assumed a lognormal distribution to get a skew. I obtain some averages from a larger sample. I want to see which average to use to best estimate the total of N randomly sampled items. It turn out that, according to this (correct?) simulation the arithmetic mean is the better average in my situation. I guess this is some empirical evidence against my gut feeling that the median is the better/more representative average in my situation ...

p1 <- log(10)
p2 <- log(2)

# obtain estimates/averages from large sample from "the truth"
x <- rlnorm(1000000, p1, p2)
plot(density(x))
median <- median(x)
mean <- mean(x)

set.seed(2021)
N <- 100 # sample size
R <- 10000 # how many times to draw samples of size N
mean_estimate_se <- median_estimate_se <- rep(NA, R)
for (i in 1:R){
    
    x <- rlnorm(N, p1, p2) 
    
    sum <- sum(x)
    
    mean_estimate_se[i] <- ((mean * N) - sum)^2
    median_estimate_se[i] <- ((median * N) - sum)^2
    
}

paste0("Error using arithmetic mean: ", round(mean(mean_estimate_se), 2))
paste0("Error using median: ", round(mean(median_estimate_se), 2))

round(mean(median_estimate_se) / mean(mean_estimate_se), 2)

enter image description here

$\endgroup$
5
$\begingroup$

Whether the distribution is skewed or not, the usual sample mean is always an unbiased estimator for the population mean.$^{\dagger}$

$$ \mathbb E\bigg[\bar X\bigg] = \mathbb E\Bigg[\frac{1}{n}\sum_{i = 1}^nX_i\Bigg]\\ = \frac{1}{n}\sum_{i = 1}^n \bigg( \mathbb E[X_i]\bigg) = \frac{1}{n} \sum_{i = 1}^n \mu = \frac{1}{n}n\mu = \mu $$

The usual sample mean is a perfectly defendable way to estimate the population mean.

Should gets into lots of fascinating ideas related to constructing estimators with desirable properties but might be a bit beyond where you want to operate. Depending on the particulars of the distribution, you might find the median to be a better estimator of the mean, perhaps based on the mean squared errors of those estimators.

$^{\dagger}$There's this annoying issues where the population mean might not exist. In that case, this calculation does not make sense, but you are trying to estimate a value that does not exist, which also does not make sense.

EDIT

In your comment, you mention that median might be a preferable estimator for a skewed distribution. Let's put that to the test in a simulation study.

set.seed(2021)
N <- 100 # sample size
R <- 1000 # how many times to draw samples of size N
means <- medians <- rep(NA, R)
for (i in 1:R){
    parameter <- 13 # the parameter of the distribution
    x <- rchisq(N, parameter) # this has a mean of parameter
    
    means[i] <- mean(x)
    medians[i] <- median(x)
    
    }

mean((means - parameter)^2)
mean((medians - parameter)^2)

I get an MSE of the sample mean of $0.25775941187491$ and an MSE of the sample median of $0.845599781948668$, more than three times as big. For this $\chi^2_3$ distribution, at least in terms of the common MSE metric, the mean is a vastly superior estimator, despite the skewness. As noted in the comments, other distributions, such as $t_3$, will give the opposite conclusion (despite the symmetry of $t_3$).

(I had trouble coming up with a skewed distribution that gave superior performance of the empirical median, and I welcome suggestions in the comments. For superiority of the empirical mean for a distribution that lacks skewness, look no further than the normal distribution. (Noted in the comments, absolute value of a low-degree-of-freedom t-distribution should do the trick.))

$\endgroup$
12
  • 3
    $\begingroup$ If you replace rchisq(, 13) by, say, rt(, 3) (which has an expectation of zero, a finite variance, and a symmetric distribution to boot), you will draw the opposite conclusion when comparing the sample mean to the median. Thus, your blanket statement "the mean is a vastly superior estimator" needs qualification. Indeed, researchers who have run extensive simulation studies have concluded that in many cases robust alternatives to the mean lose relatively little efficiency for near-Normal distributions and often have superior efficiency for less-than-Normal distributions. $\endgroup$
    – whuber
    Sep 21 at 21:08
  • 1
    $\begingroup$ If you want the expected sum of those $100$ values, sure, take $100\bar x$. You can tweak my simulation to estimate the sum of the $100$ observations instead of the mean, and it will reveal that, under the given conditions, sample mean has much lower mean squared error than sample median. // I haven’t though my through exactly how to do this, but there might be a way to use a bootstrap procedure to estimate which is better for your exact data. // Could it be that you don’t want to estimate a mean (expected value) but a median? $\endgroup$
    – Dave
    Sep 22 at 10:28
  • 1
    $\begingroup$ You have to be careful about what exactly you want. If what you want is to estimate the mean (or some multiple of the mean, such as $100\mu$), then there is an argument to use the sample mean. If you want to estimate the median (or some multiple of the median), then a different estimator might be appropriate. So what exactly do you want to estimate? $\endgroup$
    – Dave
    Sep 22 at 15:45
  • 1
    $\begingroup$ Re "superior performance of the empirical median:" take absolute values and use t distributions with small df. $\endgroup$
    – whuber
    Sep 22 at 16:00
  • 1
    $\begingroup$ You're more-or-less following what I am doing, just with log-normal instead of chi-squared, and you're coming to a similar conclusion. // Do note that you might prefer to estimate the median or sum of medians, rather than the mean or sum of means, though that is a decision for you (and a separate question if you are not sure which you want). // Quick note about your code: reconsider naming variables as existing functions like sum. I'm surprised that your code even compiled and didn't throw an error when you got to i=2 and had redefined sum to be a number instead of a function. $\endgroup$
    – Dave
    Sep 23 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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