# Test whether the study population come from a normal or log-normal distribution based on mean, median, and number of subjects

I have MEAN, MEDIAN, NSUB (number of subjects) and SD data coming from different studies and different populations. These are the only available information in the studies. My data set contains the following columns:

STUDY   NSUB   MEAN   MEDIAN   SD
1       10     1.5    1.7      0.4
2       20     1.5    1.55     0.3
3       7      2.6    3        0.5
4       15     3      3.01     0.1


And so on.

I want to judge whether the mean and median are significantly different at significance level (alpha=0.05). This is so I can make a decision whether the data from each study were come from a normal or log-normal distribution.

I thought of doing a two sided t-test. My hypothesis would be:

NULL: H0: MEAN=MEDIAN

Alternative: HA: MEAN doesn't equal MEDIAN

The standard error of the mean (SEM) can be calculated as SD/NSUB where NSUB is the number of subjects. The degree of freedom would be NSUB-1. The scenario I am presenting here is as if I am comparing two means that have the same standard deviation (SD).

Is there a way where I can apply this automatically in R for the set of data that I have and have the result added to the data as t.test.result being TRUE/FALSE (significantly different/insignificantly different). Something close to this:

STUDY   NSUB   MEAN   MEDIAN   SD     t.test.result
1       10     1.5    1.7      0.4    RESULT1?
2       20     1.5    1.55     0.3    RESULT2?
3       7      2.6    3        0.5    RESULT3?
4       15     3      3.01     0.1    RESULT4?


Also, is there a better way to test whether each study population was come from a normal or log-normal distribution?

• Comparing single observation will not have enough degree of freedom – akrun Oct 15 '15 at 4:54
• This is not how you check whether your data are log-normal v. normal. The median and mean could be different for many reasons. – John Oct 15 '15 at 5:46
• Yes, there are other alternatives even with just this data. The N allows one to simulate the two possibilities and check for most likely fits. This really should be reframed to become a CrossValidated question. When you do that you should be also discussing whether these samples are from the same or different population distributions. Because if they come from the same population checking each one for normality is probably pointless. But it means that the reason should be in the question too. – John Oct 15 '15 at 6:03
• Why do you want to compare mean and median? For symmetric distributions (like $t$ or Normal) mean = median. If distribution of your data is skewed that there is a question of validity of $t$-test with such data. In this case, question if mean = median is the same as asking if there are any significant outliers in the data. – Tim Oct 15 '15 at 7:12
• I have merged the migrated duplicate in with this question in order to retain the comments, a few of which may have some value. – Glen_b Oct 15 '15 at 10:03

df$t.critical <- qt(1-0.05/2, df$NSUB-1)

df$t.test <- abs(MEAN-MEDIAN)/(SD/sqrt(NSUB))  Third: If t.test < t.critical then add a FLAG==0 (meaning; the MEAN and MEDIAN are not significantly different and hence the population can be assumed normal). Otherwise, it is non-normal (i.e. log-normal distribution) and give it FLAG==1 df$FLAG <- ifelse(df$t.test <- df$t.critical, 0,1)