# Logarithm of dependent variable is uniformly distributed. How to calculate a confidence interval for the mean?

My dependent variable is extremely non-normally distributed (Shapiro-Wilk gives $$p=0.004$$). However, taking its logarithm gives me something freakishly close to a uniform distribution. When I plot the logarithm’s cumulative frequency it is an almost perfect straight line ($$r=0.99$$).

I want to calculate a confidence interval for the mean on the original scale. Can I treat this as log-normal data even though its logarithm is clearly not following a bell curve? Shapiro-Wilk is rejecting $$\mathrm{H}_0$$, telling me it’s not normally distributed, however for all intents and purposes it has no skewness.

If not, then what can I use to get a confidence interval?

EDIT: For what it’s worth:

There are 24 data points in the sample.

I had originally planned to compare the variable in question with some other independent variables, however exploratory data analysis found absolutely no correlation between them.

I was thinking about using the modified Cox formula described here tandfonline.com/doi/pdf/10.1080/10691898.2005.11910638, but I’m not sure whether it’s valid in the case of data that is clearly log-uniformly distributed.

• How large is the sample? – Glen_b -Reinstate Monica May 26 '19 at 7:04
• 24 data points. – Alex Tully May 26 '19 at 7:06
• And the mean you want the CI for is the original (untransformed) population? – Glen_b -Reinstate Monica May 26 '19 at 7:06
• Yes it is thanks. – Alex Tully May 26 '19 at 7:07
• I wast thinking about using the modified Cox formula described here tandfonline.com/doi/pdf/10.1080/10691898.2005.11910638, but I’m not sure whether it’s valid in the case of data that is clearly log-uniformly distributed. – Alex Tully May 26 '19 at 7:11

Can I treat this as log-normal data even though its logarithm is clearly not following a bell curve?

No, in this case you are dealing with a variable that is log-uniform distributed.

One approach is to use the bootstrap, where you takes samples repeatedly with replacement and compute the means of the samples.

See the answers to this question, which deals with log-normal data, but the principles are the same:

How do I calculate a confidence interval for the mean of a log-normal data set?

In regression problems the marginal distribution of Y does not matter. The conditional distribution of Y | X is what matters. For some problems this translates to examining the distribution of the model residuals.

But your sample size is too small to check assumptions. It would be far better to use a robust approach that has many fewer assumptions, e.g.

1. If you have one X and want to quantify the strength of relationship between X and Y, use a rank correlation coefficient
2. Use a semiparametric regression model such as the proportional odds model that makes no assumption about the distribution of Y | X but only makes assumptions about the relative shapes of conditional distributions across different value of X. This generalizes rank correlation and Wilcoxon-type methods.
3. Use a Bayesian model that generalizes the usual models, e.g., that has a prior distribution for the degree of non-normality or non-constant variance of conditional distributions.
4. Use the bootstrap as advised above, but be cautious because the bootstrap is only approximate.
• Indeed, on item 4; it would probably be worth investigating how the bootstrap behaves on this problem. The arguments for its properties are large-sample ones and in at least some instances the behavior on small samples can be alarming. In this particular instance I expect it will be fine but its not something it's always safe to assume (i.e. sometimes 'approximate' may be much more approximate than many people realize -- I've seen cases where small sample coverage of a 95% bootstrap interval was much more like 60%). – Glen_b -Reinstate Monica May 26 '19 at 22:14
• One simulation I did with unbalanced Y showed terrible coverage for all bootstrap intervals (except bootstrap t which I didn't try), with the ordinary Wald interval outperforming them. The regular profile likelihood confidence interval worked fine, i.e., was as accurate as a Bayesian credible interval with a non-informative prior. – Frank Harrell May 26 '19 at 22:22

Something whose log would be close to uniform is somewhat skew, but not particularly difficult to deal with; sample means of size 24 will be very close to normally distributed.

If it were actually log-uniform we could work out a suitable interval fairly readily but I wouldn't actually use the fact that the sample looks like its log is uniform; with only 24 observations that judgement may be rather suspect and you certainly don't want to be doing such model selection/identification on the very sample you're using for inference, since you don't have a good way of accounting for the effect of that (e.g. it will tend to make intervals narrower than they should be but quantifying how much is rather tricky). If they were actually log-uniform those narrower intervals would be "honestly" narrow, but there's no good basis to say so.

Simulation at n=24 suggests that a 95% two-tailed t-interval on the untransformed data should perform reasonably well (i.e. give coverage very close to 95%) for data something similar to this, even though this is not actually normal and the distribution of sample means is slightly skew. If you want to go far into the tails it may be more of an issue, but a 95% two-sided interval should be fine.

• Overall coverage is not sufficient. What are the two tail (non-coverage) probabilities? – Frank Harrell May 26 '19 at 11:14
• Whether it's sufficient or not really depends on the application; if you want the advertized coverage and essentially get it, you might well be content. Roughly speaking one's about 3% (a bit under), the other's about 2%. The left tail of the distribution of the t-statistic is "short". – Glen_b -Reinstate Monica May 26 '19 at 22:02