# Handling Skewed Data: A Comparison of Two Popular Methods
## 2 Materials and Methods  
Using Monte Carlo simulations, we simulated continuous skewed data for two groups. We then tested for differences between group means using two methods: a two-group \(t\)-test for the log-transformed data and a GLM model for the untransformed skewed data. All skewed data were simulated from three different continuous distributions: gamma, exponential, or beta distributions. For each simulated data set, we tested the null hypothesis (\(H_{0}\)) of no difference between the two groups means against the alternative hypothesis (\(H_{a}\)) that there was a difference between the two groups means. The significance level was fixed at \(\alpha=0.05\). Three sample sizes (\(N=25,\ 50,\ 100\)) were considered. The Shapiro-Wilk test was used to test the normality of the simulated data before and after the application of the log transformation. We applied two conditions (filters) on the data: it was only accepted if it was not normal in the beginning, and then it became normal after log transformation. The only considered scenarios were the ones with more than 10,000 data sets after applying the two conditions and the number of accepted simulated samples = T. We chose T to be greater than 10,000 to overcome minor variations attributable changing the random seed in the SAS code. Afterward, a \(t\)-test was applied to transformed data, while a GLM model was fitted to untransformed skewed data. We used the logit link function when the data were simulated from a beta distribution, and we used the log link function when the data were simulated from the exponential distribution or gamma distributions. In each case, a binary indicator of group membership was included as the only covariate. The two methods were compared regarding Type I error, power rates, and bias. To assess the Type I error rate, which is the probability of rejecting \(H_{0}\) when \(H_{0}\) is true, we simulated the two samples from the same distribution with the same parameters. The same parameters guaranteed statistically equal variances between groups, and thus we used the equal-variance two-sample \(t\)-test. In addition, the GLM method with an appropriate link function was used. If the \(p\)-value was less than the two-sided 5% significance level, then \(H_{0}\) was rejected and a Type I error was committed (since \(H_{0}\) was true). The Type I error rate is then the number of times \(H_{0}\) was rejected (K for \(t\)-test and KGLM for GLM) divided by the total number of accepted simulated samples (K/T or KGLM/T). To assess the power rate, which is the probability of rejecting \(H_{0}\) when \(H_{\text{a}}\) is true and it is the complement of the Type II error rate, we assumed different mean values for the two groups by simulating the two groups from distributions with different parameters. In this case, since the variances are functions of the mean parameter as well, the unequal variance two-sample \(t\)-test was used. In these situations, if the \(p\)-value was less than the 5% significance level, then we rejected \(H_{0}\) knowing that \(H_{\text{a}}\) is true. If the \(p\)-value was larger than the significance level, we failed to reject \(H_{0}\) and concluded that a Type II error was committed (because \(H_{\text{a}}\) was true). Then, the power rate is the number of times \(H_{0}\) was rejected (K for \(t\)-test and KGLM for GLM) divided by the total number of accepted simulated samples (K/T or KGLM/T). Each case (sample size, distribution, mean relationship) was repeated five million times (denoted as T\({}_{0}\)). The diagram of testing the Type I error algorithm is shown in Figure 2.  
Regarding the difference estimates, other methods work on the response differently. The log transformation changes each response value, while the GLM transforms only the mean response through the link function. Researchers tend to transform back estimates after using a \(t\)-test with transformed data or after using GLM. We wanted to test which method gives a closer estimate to the actual difference estimates.