# Does t test only work for continuous random variable?

When using t test normally we would assume the original data follows normal distribution, but if the sample size is large enough, this assumption can be ignored due to Central Limit Theory.

I thought since normal distribution is for continuous random variable, even if the data does not have normality, it at least must be continuous random variable in order to use the t test. However in practice, I found that the t test is widely used even for discrete random variable such as hospital length of stay (LOS) in days (which is integer and thus discrete random variable).

So my question is, is it a common practice to apply t test on discrete random variable? If not, when we want to compare the mean of two groups consisting of discrete random variable, except for Wilcoxon Signed Rank Test, what other tests can I use?

Remember the Central Limit Theorem is talking about the asymptotic distribution of the standardised mean of iid random variables. So even if your random variables are discrete, as you accumulate more and more of them, once you take their mean (and then standardise it), you'll end up with a random variable which acts more and more like a continuous random variable.

For example, if you have 100 Bernoulli random variables (each either 0 or 1), then the possible means are $0.00, 0.01, 0.02, \dots , 1.00$. If you have 1000 then the possible means are $0.000, 0.001, 0.002, \dots , 1.000$.

So even if you have discrete random variables, their mean can still be asymptotically normal.

• Note that the central limit theorem relates not to the mean itself but to a standardized mean. When necessary conditions hold, the sample mean itself is asymptotically just going to go to a constant -- the population mean. – Glen_b -Reinstate Monica Jul 17 '17 at 8:20
• Thank you @Glen_b, you're absolutely right. I just mentally absorbed the standardisation into the variance of the approximate normal for a particular sample, but of course that's silly since it undermines the point of the convergence in distribution result. – RoryT Jul 17 '17 at 8:32
• Thanks for your answer, that helped a lot! But as for central limit theorem, I am a little confused at your comments. The CLT says that 'given certain conditions, the arithmetic mean (or sum) of a sufficiently large number of iterates of independent random variables, each with a well-defined (finite) expected value and finite variance, will be approximately normally distributed, regardless of the underlying distribution'. To my understanding, the sample mean itself is related to CLT already, why does it to be 'standardised mean' like @Glen_b said? Could you shed more light? – user6892253 Jul 17 '17 at 9:33
• No worries. The mean itself is approximately normally distributed if you've got a large enough number of iid variables. However, as you take more and more iid variables, their mean will get closer and closer to the population mean, and will be less and less variable. If you multiply the difference between the sample and population mean by $\sqrt{n}$ then this counteracts the fact that the sample mean is getting closer and closer to the population mean. This is what we mean by standardisation. The standardised mean will be asymptotically distributed as a standard normal (i.e. $N(0,1)$) – RoryT Jul 17 '17 at 10:23

Does T Test only work for continuous random variable?

It depends on what you mean by "work".

When using T test normally we would assume the original data follows normal distribution, but if the sample size is large enough, this assumption can be ignored due to Central Limit Theory.

Not if you care about power.

I thought since normal distribution is for continuous random variable, even if the data does not have normality, it at least must be continuous random variable in order to use the t test.

Your argument that was based on the CLT wouldn't distinguish between discrete and continuous variables -- the CLT applies to either.

However in practice, I found that the t test is widely used even for discrete random variable such as hospital length of stay (LOS) in days (which is integer and thus discrete random variable).

It does get used on discrete data (and on obviously non-normal continuous data, and on data that are neither discrete nor continuous) at least sometimes. Some of those times, it's probably quite reasonable to do so (in that the significance level will be close to the nominal level and the power will be at least adequate).

I would tend to avoid it in that length-of-stay case; leaving aside likely issues with censoring, you have something which may be extremely right skew and even if your sample size were huge, the power may still be poor.

So my question is is it a common practice to apply t test on discrete random variable?

If you're going to apply it in a case where you can be confident your samples are drawn from something that's fairly non-normal you'd probably want to have an argument ready for why it would perform reasonably well.

If not, when we want to compare the mean of two groups consisting of discrete random variable, except for Wilcoxon Signed Rank Test, what other tests can I use?

A signed rank test is a one-sample test (or a paired-sample test), not a two-sample test. It also doesn't compare means (it could reject in the wrong direction, for example)

You might use a permutation test of the difference in means, or make a different parametric assumption (in some situations you might consider a negative binomial assumption for example, or some other discrete distribution -- depending on circumstances), or perhaps add some assumptions to a Wilcoxon-Mann-Whitney that could make it also a comparison of means (though it won't necessarily outperform the t for discrete skewed cases).

• What do you mean my power in your answer? – SpeedBirdNine Jul 17 '17 at 16:31
• en.wikipedia.org/wiki/Statistical_power – Glen_b -Reinstate Monica Jul 17 '17 at 22:17
• @Glen_b Your answer is so compact and helpful, thanks a lot! As for the statistical power you have mentioned, I know that parametric testing tends to have more power than non-parametric testing, but have no idea that the skewness of data would effect the power that much, could you elaborate more? Or is there any good recommended paper for me to learn from? Thanks! – user6892253 Jul 18 '17 at 7:59
• Actually, in many cases widely used parametric tests only tend to have slightly more power than the commonly used nonparametric tests when the assumptions of the parametric test are exactly true. When the assumptions are not true, the power of the nonparametric procedure may be much higher. For example, consider an ordinary equal variance two sample t-test compared to a Wilcoxon-Mann-Whitney. When the data are iid normal, the t-test has about 4.5% better efficiency in large samples (it's like the t-test has 22 observations worth of information every time the WMW has 21). – Glen_b -Reinstate Monica Jul 18 '17 at 8:15
• That's not even the most powerful nonparametric test at the normal. But when the tails are very heavy, the WMW may be vastly more efficient in large samples than the t. But when I said "power may still be poor" I wasn't necessarily advocating nonparametric tests for the discrete skew case (power is sometimes poor for some of those too, though for slightly different reasons). – Glen_b -Reinstate Monica Jul 18 '17 at 8:17

Theoretically, t-test is only for continuous data because discrete data can never meet normality assumption. However, t-test is quite robust given enough samples.

Applying t-test for discrete value is actually quite common. For example, the popular way to test for microarray gene expression array is: moderated t-Test.

https://www.dnastar.com/arraystar_help/index.html#!Documents/moderatedttest.htm

Gene expression is counting data and certainly not continuous. But t-test is simple and good enough.

EDIT:

I think @Glen_b is correct. But, discrete data simply don't satisfy theoretical assumptions, whereas there's a possibility that continuous data do satisfy.

Again he's correct. In my example, the method assumes asymptotic behaviour of the sample means.

EDIT:

t-test is indeed common for discrete test (answer @Glen_b), especially when we have a large sample and the histogram of the distribution "looks" normal anyway (not skewed).

The t-test is simple for everybody to understand. In many practical applications, a good-enough and easy statistical test is sufficient.

• Continuous data that's not normal can never actually meet the normality assumption either (not even on average -- sample means of iid continuous rvs can only have a normal distribution if they were to begin with -- the convergence, whether from discrete or continuous population is only asymptotic either way). I doubt the normality assumption is ever true on real data. – Glen_b -Reinstate Monica Jul 17 '17 at 10:20
• When you say 't test is common for discrete test when we have a large sample and the histogram of the distribution looks normal', what about the skewed discrete data with a large sample size, is there any method to verify whether t test can work well in such case? – user6892253 Jul 18 '17 at 8:19