# Conducting a two sample t-test using log transformed non-normally distributed data

I have two data sets, where sulfate concentrations of groundwater in a specific site are shown for two different years

2013

1000,1530,694,432,370,750,337,432,1562,469,1520,601,469,439,699,316,372,929,841,810,583,163,286,693,129,313,651

2014

785,584,1270,499,452,452,996,883,737,78,443,253,149,199,401,961,642,824,190,462,404,172,222,526

2013 data is not normally distributed (tested using Shapiro-Wilk normality test p value is 0.003. 2014 data is normally distributed (p-value = 0.26). Used R software.

Can I log transform both data sets to get a normal distribution for both groups so I can conduct a two sample welch test? Also, will I have to back-calculate the p-value resultant from log-transformed t-test?

Thank you.

• Failure to reject normality doesn't mean that you have it; you aren't going to have it with real data -- it's a model, an approximation. – Glen_b Oct 27 '17 at 11:48

I don't believe the means (or medians) for the two years differ significantly. Just looking at side-by-side boxplots of the two samples, I did not expect to find significant differences. The 'notches' in the sides of the boxplots indicate nonparametric confidence intervals for population medians, and the intervals overlap. (It might be worthwhile to find out whether the outliers in 2013 sulfate levels were due to actual temporary or local spikes in sulfate or whether they were due to measurement error.)

When I do a Welch t test on the two log-transformed samples, I get about the same result as for a Welch t test on the original samples. P-values are about 0.2 in both cases. No significant difference between years.

t.test(log(x1),log(x2))

Welch Two Sample t-test

data:  log(x1) and log(x2)
t = 1.2682, df = 46.122, p-value = 0.2111
...


If the results from the logged data were significant, you might have some trouble explaining why the differences in log(sulfate) are worth studying, but the P-value for the logged data needs no transformation.

Also, a 2-sample Wilcoxon rank sum test gave a larger P-value along with a warning message about ties, and a permutation test showed no significant difference. Neither of these nonparametric tests should be bothered by the outliers in the data for 2013.

Just to make sure I correctly scraped your data from the screen, my summary statistics are as follows.

summary(x1)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
129.0   371.0   583.0   644.1   780.0  1562.0
summary(x2)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
78.0   245.2   457.0   524.3   749.0  1270.0

• Thank you very much once again. You have been so helpful and I highly appreciate it. I fear that my sample size might be too small for parametric tests.. Isn't it a standard to have n ≥ 30? As you recall I had a sample size of 10 or so in my previous question that I answered. Many thanks again! – chrisuw92 Oct 27 '17 at 5:17
• Glad this is useful.// When you have a satisfactory answer to a question, please click the check mark next to it to 'Accept', so the question will go off our list of questions that still need answers.// But if you need something more on the same topic,edit the question or leave a comment.// Please take the 'tour' of the site. – BruceET Oct 27 '17 at 7:06