I have some cells which fluorescence and I can detect their fluorescence. So for each cell I get a number N that says how much light it emitted. I also have two kinds of cells A and B. I have measured 1000 cells of type A and B each which gives a distribution for each type. I want to know if the mean and standard deviation of these two distributions is the same or not.

In practice (the following numbers are made up the actual measurements contains +25000 cells), I measured 100 A cells 10 times (in total 1000 different cells) and I did similarly for B cells. Each measurement (that includes 100 cells) gives a sample mean and a standard deviation. Now I want to see if the mean emitted light and the standard deviation of emitted light by cells A and B is the same or not so I do a t-test.

My question is if I rearranged my data does it affect the t-test? For example, consider two extremes:

  1. I divide my 1000 measurements for each type of cells into 20 groups of 50 cells instead of 10 groups of 100.

  2. I only consider one group of 1000 cells.

The mean stays the same but the standard deviation changes based on group size. For example, in the second case it is zero!

How should I divide my data into groups for t-test? Or, alternatively, how can I know two distribution have equal mean and standard deviation?


1 Answer 1


The tl;dr version: I think it would be better to do a two-sample Kolmogorov–Smirnov test on the original (not binned) data.

Extended answer:

A direct reply to your last question is: you can use an F-test to compare variances (the square of the standard deviations). Better versions of this test are the Levene's test or the Bartlett's test.

However, there are other approaches that may be more accurate. In particular, you didn't say anything about the Normality. And the t-test and the F-test assume Normality of the distributions. For such large samples, taking a look at the skewness and kurtosis, together with a Q-Q plot might help to assess Normality.

Nevertheless, comparing means and standard deviations do not guarantee that the distributions are similar -- you may have two distributions with the same mean and standard deviation that, e.g., have different skewness and/or kurtosis. So, to compare distributions, you can use the two-sample Kolmogorov–Smirnov test. Again, a graphical method is also useful to see if the differences (even if significant) are relevant. For instance, you may plot the CDF of both samples to see how large are the differences between them.

Regarding binning the data, I usually advise against it. I think you can compute the mean and standard deviation of $N$ for group A and for group B and these will be indicative of each sample characteristics.

By the way, if you had different type of data, where cells would either be on or off, then the more appropriate test for this dichotomous case would be Fisher's exact test.

  • $\begingroup$ Thanks. Regarding comparing means, the data itself is not normally distributed. I thought that if I bin the data and calculate the mean inside each bin then sample mean should be normal according to the central limit theorem. Then I can use t test to compare means. However then how someone decides to bin the data for t test? Is it arbitrary? If I use all the data in one bin, then how I be sure the differences are significant? How does bin size affect t test? $\endgroup$
    – MOON
    Dec 14, 2019 at 13:58
  • $\begingroup$ Continued: the way I understand is that the bin size should be large enough to give a normal sample mean distribution and also the number of sample means should be high enough to get a reliable standard deviation of sample means to get a reliable t test. $\endgroup$
    – MOON
    Dec 14, 2019 at 14:07
  • $\begingroup$ For large sample sizes, the t-test is pretty robust to deviations from normality. It looks like you have a couple thousand observations. You should be safe. $\endgroup$
    – Dave
    Dec 14, 2019 at 15:03
  • $\begingroup$ Regarding your comments, @MOON, note that each bin will have it's mean, and there is no guarantee that the distribution of the means over the different bins follows a Normal distribution. This happens because the bins are not independent (one of the assumptions of the Central Limit Theorem). $\endgroup$ Dec 14, 2019 at 16:14
  • $\begingroup$ @MOON, as to compare the means, you will have the sample size, the mean and the standard deviation of $N$ for cells A and the sample size, the mean and the standard deviation for cells B. These 6 numbers are enough to compute the t-test (and also the Welch's t-test). $\endgroup$ Dec 14, 2019 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.