0
$\begingroup$

I need to transform my not normal distributed data to normal distributed variables. Therefore I need to log-transform them. Log10(x+1) has not worked to create a normal distribution. Therefore, I want to do a log100 transformation but it does not work in R. How do I write the function to get the new data? Thanks a lot!!!

E. g.t one variable of my data set is "cover single". the hist() is: enter image description here

and according to the test of normal distribution: Shapiro-Wilk normality test

data: daten$Cover_single W = 0.85141, p-value = 8.116e-05

with hist(log10(daten$Cover_single+1)) the following hist exists: enter image description here

Shapiro-Wilk normality test

data: log10(daten$Cover_single + 1) W = 0.79318, p-value = 3.942e-06

So i dont get this variable into normal distribution by transformation. How can I do this in R?

$\endgroup$
  • $\begingroup$ Can you show us some plots of your data. $\endgroup$ – user2974951 Jan 9 at 9:50
  • $\begingroup$ i included two pictures $\endgroup$ – sonnisonja Jan 9 at 10:42
  • $\begingroup$ You seem to have asymmetric data with a left fat tail, I don't think this can be transformed to normal looking data. Why are you trying to do this anyway? For the Shapiro-Wilk assumption? $\endgroup$ – user2974951 Jan 9 at 10:46
  • 2
    $\begingroup$ Please say more about why you think you need to transform your data into a normal distribution. This is often not necessary and with a small data set you don’t often have enough power to perform a proper test of normality. See this page for extensive discussion. In your case the data seem to be proportions; there are ways to summarize such data or test hypotheses with them that don’t require normality. Providing more information about the underlying scientific question you are addressing might lead to an answer with a better way to proceed. $\endgroup$ – EdM Jan 9 at 11:06
  • 1
    $\begingroup$ Note that if logarithm to one base is not successful, using a different base won't make any difference. Here as cover may well be defined as between 0 and 1, it's likely that if any transformation is a good idea, it will be something else, as @EdM is also hinting. Note that your supervisor not liking GLMs is an important detail to you, it's a recipe for neglecting valuable tools. $\endgroup$ – Nick Cox Jan 9 at 13:51
1
$\begingroup$

For a linear model your predictor variables don't need to be normally distributed and your outcome variable does not not need to be distributed normally overall. What matters for standard statistical testing in a linear model is a normal distribution of residuals around the predicted values. Furthermore, much can be learned from linear modeling even if that assumption does not hold, providing ideas to deal with violations of that assumption. See this page for illustrations of why normality of the outcome variable is not needed, and this page for discussion of the ways in which normality of residuals might matter.

From your description it seems that your data could be handled by some type of multiple regression rather than by classic ANOVA. With dormouse abundance as the outcome variable, a straightforward linear regression of abundance against your untransformed predictors might work quite well. Try that, then test whether the assumption of linearity in the values of the predictors holds. Only then do you need to pay attention to the distributions of residuals and whether further transformation of your abundance values, or some type of generalized linear model, need to be considered.

$\endgroup$
  • $\begingroup$ Thanks a lot! Yeah i decided to work with the data as they are without transforming them. One additional question. I would like to plot all my variables individually against the dormouse abundance using correlation plots. So I type into R the following code: plot(daten$Nr_Nests~daten$Cover_single, ylab = "Dormouse Abundance", xlab = "Cover Single") abline(lm(Nr_Nests~Cover_single, data=daten)) cor(daten$Nr_Nests, daten$Cover_single, method = "spearman") cor.test(daten$Nr_Nests, daten$Cover_single, method ="spearman") can I even do this now with my non-normal distributed data? $\endgroup$ – sonnisonja Jan 9 at 16:43
  • 1
    $\begingroup$ Note that dollar signs need special action if they are not to be interpreted as mark-up for mathematics. Spearman correlations don't require normal distributions as they ignore everything but rank. The test of a linear fit is whether it matches the data; marginal distributions are irrelevant as such. $\endgroup$ – Nick Cox Jan 9 at 16:52
  • $\begingroup$ @sonnisonja your most useful results are in the linear-regression coefficients for the predictors, as each takes the influences of all the other predictors into account. The Spearman method you propose for testing correlations does not require an assumption of normality, unlike the Pearson method. The plots and correlations of abundance against each individual predictor, however, do not take the other predictors into account and could end up being misleading. $\endgroup$ – EdM Jan 9 at 16:53
  • $\begingroup$ this is exactly what I mean. So if I do this correlation plot by "plot(daten$Nr_Nests~daten$Cover_single)" and then the abline by "abline(lm(Nr_Nests~Cover_single, data=daten))" it might not be suitable or work properly because "lm" is used for normal distributed data? Because I want to include the plots in my thesis as well as the statistical evaluation using cor.test. But I can only do this if I can actually plot it with "plot(lm)" $\endgroup$ – sonnisonja Jan 9 at 18:15
  • $\begingroup$ There is excellent advice here (+1 from me), but the nature of the response, dormouse abundance, deserves more attention. Abundance usually can't be negative (if you have negative values, you're using an unusual scale) and is often better analysed with a GLM and log link function. If there is scope for posting your data, further advice may be possible. $\endgroup$ – Nick Cox Jan 10 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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