19
$\begingroup$

How can I calculate the confidence interval of a mean in a non-normally distributed sample?

I understand bootstrap methods are commonly used here, but I am open to other options. While I am looking for a non-parametric option, if someone can convince me that a parametric solution is valid that would be fine. The sample size is > 400.

If anyone could give a sample in R it would be much appreciated.

$\endgroup$
  • 3
    $\begingroup$ The Central Limit Theorem implies that the limiting distribution of the sample mean is normal regardless of the distribution of the original data (under some conditions). In many cases a sample size $n>400$ is large enough so that the normal approximation is quite accurate but the accuracy does depend on the parent distribution-- it might help if you, for example, posted a histogram of the original data. $\endgroup$ – Macro Oct 5 '11 at 3:51
18
$\begingroup$

First of all, I would check whether the mean is an appropriate index for the task at hand. If you are looking for "a typical/ or central value" of a skewed distribution, the mean might point you to a rather non-representative value. Consider the log-normal distribution:

x <- rlnorm(1000)
plot(density(x), xlim=c(0, 10))
abline(v=mean(x), col="red")
abline(v=mean(x, tr=.20), col="darkgreen")
abline(v=median(x), col="blue")

Mean (red), 20% trimmed mean (green), and median (blue) for the log-normal distribution

The mean (red line) is rather far away from the bulk of the data. 20% trimmed mean (green) and median (blue) are closer to the "typical" value.

The results depend on the type of your "non-normal" distribution (a histogram of your actual data would be helpful). If it is not skewed, but has heavy tails, your CIs will be very wide.

In any case, I think that bootstrapping indeed is a good approach, as it also can give you asymmetrical CIs. The R package simpleboot is a good start:

library(simpleboot)
# 20% trimmed mean bootstrap
b1 <- one.boot(x, mean, R=2000, tr=.2)
boot.ci(b1, type=c("perc", "bca"))

... gives you following result:

# The bootstrap trimmed mean:
> b1$t0
[1] 1.144648

BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 2000 bootstrap replicates
Intervals : 
Level     Percentile            BCa          
95%   ( 1.062,  1.228 )   ( 1.065,  1.229 )  
Calculations and Intervals on Original Scale
$\endgroup$
  • $\begingroup$ Thanks very much for the detailed answer. Would you care to comment on the (minimal) difference between the percentile and adjusted percentile (BCa) statistics? $\endgroup$ – fmark Oct 5 '11 at 5:49
  • $\begingroup$ "The bootstrap bias-corrected accelerated (BCa) interval is a modification of the percentile method that adjusts the percentiles to correct for bias and skewness" (Hesterberg, T., Monaghan, S., Moore, D., Clipson, A., & Epstein, R. (2005). Bootstrap methods and permutation tests. Introduction to the Practice of Statistics, 14.1–14.70.). Whenever the software allows it, use the BCa corrected CI (note: it needs > 1000 resamples) $\endgroup$ – Felix S Oct 5 '11 at 7:39
  • $\begingroup$ It seems from the documentation for the simpleboot package that the argument for trimming is no longer supported. :( $\endgroup$ – et is Nov 23 '16 at 22:55
8
$\begingroup$

If you are open to a semi-parametric solution, here's one: Johnson, N. (1978) Modified t Tests and Confidence Intervals for Asymmetrical Populations, JASA. The center of the confidence interval is shifted by $\hat\kappa/(6s^2n)$, where $\hat\kappa$ is the estimate of the population third moment, and the width stays the same. Given that the width of the confidence interval is $O(n^{-1/2})$, and the correction for the mean is $O(n^{-1})$, you need to have a really sizable skewness (of the order $n^{1/2}>20$) for it to matter with $n>400$. The bootstrap should give you an asymptotically equivalent interval, but you would also have the simulation noise added to the picture. (The bootstrap CI corrects for the same first order term automatically, according to the general Bootstrap and Edgeworth Expansion (Hall 1995) theory.) For what I can recall about simulation evidence, the bootstrap CIs are somewhat fatter than the CIs based on the analytic expressions, though.

Having the analytic form of the mean correction would give you an immediate idea of whether the skewness really needs to be taken into account in your mean estimation problem. In a way, this is a diagnostic tool of how bad the situation is. In the example of the lognormal distribution given by Felix, the normalized skewness of the population distribution is $(\exp(1)+2)*\sqrt{ \exp(1) - 1}$, which is kappa = (exp(1)+2)*sqrt( exp(1) - 1) = 6.184877. The width of the CI (using the standard deviation of the population distribution, s = sqrt( (exp(1)-1)*exp(1) ) = 2.161197) is 2*s*qnorm(0.975)/sqrt(n) = 0.2678999, while the correction for the mean is kappa*s/(6*n) = 0.00222779 (the standard deviation migrated to the numerator since kappa is the scale-free skewness, while Johnson's formula deals with the unscaled population third central moment), i.e., about 1/100th of the width of the CI. Should you bother? I'd say, no.

$\endgroup$
2
$\begingroup$

Try a log-normal distribution, calculating:

  1. Logarithm of the data;
  2. Mean and standard deviation of (1)
  3. Confidence interval corresponding to (2)
  4. Exponential of (3)

You'll end up with an asymmetric confidence interval around the expected value (which is not the mean of the raw data).

$\endgroup$

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.