# How to log transform Z-scores?

The data for my variable is in the form of Z-scores only. I'd like to log transform the scores, but I don't know the mean or standard deviation in order to covert to raw scores. Can I assign an arbitrary mean and standard deviation, use that to convert to raw scores, then log transform the raw scores? Or is there some other way to log transform Z-scores? Thanks.

-
Why do you want to log transform them? –  Karl Oct 11 '11 at 2:04
In answer to the question, "Why do you want to log transform the Z-scores?", I would like to use the variable as a predictor in multiple linear regression analysis (OLS). I've read that predictor variables need not be normally distributed, but I've also seen examples in which (positively) skewed predictors have been log transformed so presumably there is some advantage to this. Would you agree there is some advantage? Thank you to the people who answered my question. –  user6764 Oct 11 '11 at 18:28
One typically uses a transformation such as e.g. the logarithm if it turns out that the relationship between the dependent and a predictor variable is non-linear. Have you had a look at the partial residual plot of the incriminated variable? Is non-linearity an issue in your model? –  user5644 Oct 12 '11 at 10:41

### A few quick points about logs

The following R code is a reminder that the log of a negative number is not a number and that the log of zero is negative infinity. Thus, if you are going to take a log of a z-score, you first need to make all values obtained greater than zero.

> values <- c(-2, -1, 0, .001, .1, 1, 10)
> data.frame(values=values, logvalues=log(values))
values logvalues
1 -2.000       NaN
2 -1.000       NaN
3  0.000      -Inf
4  0.001 -6.907755
5  0.100 -2.302585
6  1.000  0.000000
7 10.000  2.302585
Warning message:
In log(values) : NaNs produced


### A simple strategy of logs on z-scores

A simple strategy for log transforming a variable is to first add a constant to the variable such that the minimum value is one. i.e., 1 + x - min(x).

The following code shows a simple example of some standardised positively skewed data. The minimum of 1 + x - min(x) is 1. Thus, the variable can be log transformed. The plot then shows the density before and after transformation.

> set.seed(4444)
> # some skewed raw data
> x <- scale((rnorm(1000) + 3)^2)
>
> xnew <- 1 + x - min(x)
> min(xnew)
[1] 1
> min(x)
[1] -1.584252
> xnew <- log(xnew)
>
> par(mfrow=c(2,1))
> plot(density(x))
> plot(density(xnew))


### But exactly what transformation should you perform?

• There is a general issue of whether a log transformation is appropriate to your data, and if so, what constant you should add to your raw data.
• Presumably if you already have z-scores, then you don't care too much about the absolute metric.
• You'll find further discussion of this issue on this question
-
With only slightly more work, you can select an additive constant that makes the resulting distribution as symmetric as possible (measured in any convenient, robust way; a handy method is to match outer percentiles, such as by achieving $z_{0.90}-z_{0.50}=z_{0.50}-z_{0.10}$ after transformation). This has a much better chance of accomplishing the objective of the transformation, which frequently is to achieve symmetry. –  whuber Oct 11 '11 at 17:26