How can I calculate the confidence interval of a mean in a non-normally distributed sample? 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.
 A: 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.
A: Try a log-normal distribution, calculating:


*

*Logarithm of the data;

*Mean and standard deviation of (1)

*Confidence interval corresponding to (2)

*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).
A: 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")


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

