# t-test when the data population is not normally distributed

I understand that according to CLT the estimator would become normal but, If my population is not normally distributed, let's say it is uniformly distributed. Can I use t-test? let's also assume that I have a large sample size more than 1000.

Yes, you can, for precisely the reason you give: even if the underlying population is not normally distributed, the mean (or more precisely the difference between the means) is asymptotically normal. (There are some conditions on the underlying populations that are usually satisfied in the real world, and certainly for underlying uniform distributions.)

Let's illustrate with a simulation (R code): we consider two populations, one $$U[0,10]$$ and the other $$U[0.5,10.5]$$, and a total sample size of 1000, half from each population. Here is a sample and a t-test:

nn <- 1000

draw_1 <- function(n) runif(n, 0, 10)
draw_2 <- function(n) runif(n, 0.5, 10.5)

set.seed(1)
sample_1 <- draw_1(nn/2)
sample_2 <- draw_2(nn/2)

t.test(sample_1,sample_2)


which yields

        Welch Two Sample t-test

data:  sample_1 and sample_2
t = -3.1827, df = 996.74, p-value = 0.001504
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.9387957 -0.2226748
sample estimates:
mean of x mean of y
4.956549  5.537284


Now, to see that the difference in means is normal enough, we simulate drawing samples and calculating means many times:

means <- replicate(1e4,{
sample_1 <- draw_1(nn/2)
sample_2 <- draw_2(nn/2)
mean(sample_2)-mean(sample_1)})

hist(means) Of course, this difference is not really normal (for one, it's bounded between -9.5 and 10.5, whereas the normal distribution is unbounded), but it's normal "enough" for the t test to work.

• Down-vote is a puzzlement. So (+1) now. Similar recent Q&A. Permutation test is nice idea. May 14, 2020 at 6:44
• @BruceET: Thank you! I would also be interested in the reason for the downvote. May 14, 2020 at 6:52
• Thank you, this made a lot of things clear but, this brings up another question. So according to CLT, the mean of the sample or the test statistic will be asymptotically normal at some 'n' for any underlying distribution. Then when do we move to non-parametric tests like wilcoxon and how do we check for the asymptotic normality of test statistic? In real life we will have only one value for test statistic. May 14, 2020 at 15:04
• Nonparametric tests have their place if $n$ is small. For medium-sized $n$, one can bootstrap the test statistic to get a feeling for whether asymptotics have already kicked in. I used to hand-code permutation alternatives to parametric tests in quite complicated situations precisely because I was afraid the $n$ was not yet large enough, and found to my dismay that p values were very close to the ones from the parametric test. In the end, it really comes down to experience. May 14, 2020 at 15:31