The effect of log transforming

First, I would like to generate a vector of values between 1 to 1000

non_log_values<-c(1:1000)

Now, I want to create another vector, that uses the same values, only log-transformed

log_values<-log(non_log_values)

Now, I want to plot these 2 vectors against one another

plot(non_log_values, log_values)

As you can see from the above plot, taking the log of larger values has a much more dramatic impact than taking the log of smaller values.

The effect of power transforming

The power transformation is quite similar to the log transformation, only it is in reverse and has a slightly less dramatic curve.

Again, let’s generate some data, starting with non-transformed

not_transformed<-c(1:1000)

Now let’s create another vector with the same data, squared.

pwr_transformed<-not_transformed^2

And then again, let’s take a look at a plot of these data.

plot(not_transformed, pwr_transformed)

The effect of square root transforming

This is really just another way of looking at a power transformation

Let’s again generate some data.

not_transformed<-c(1:1000)

Now let’s take the square root of said data.

sqrt_transformed<-sqrt(not_transformed)

Now let’s plot the data

plot(not_transformed, sqrt_transformed)