2
$\begingroup$

The function called scale, in R, does the same of subtracting the mean and dividing by the sd each element.

So the scale function allows to take in count differente parameter with different scale.

# Manually scaling (x - mean(x)) / sd(x)

# Default scaling scale(x)

But, does it make sense scale a variable if it doesn't have a normal distribution?

Andrea

$\endgroup$
10
  • $\begingroup$ This is not a good question for stackoverflow since it is not a coding question. $\endgroup$ Apr 22, 2016 at 14:55
  • $\begingroup$ It depends on your purpose. In general answer is no. But for representation - why not. $\endgroup$ Apr 22, 2016 at 15:27
  • 1
    $\begingroup$ I'm not sure if this is the issue, but keep in mind that, if you've got data, you can compute the mean and standard deviation. Then you can subtract the mean from each point and divide by the standard deviation. Now you've got a new data set with mean 0 and standard deviation 1, which is often helpful and the reason we do scaling in the first place. As User7598 noted, scaling doesn't change many of the other useful things we want to know about that data, so it's a nice way to make your data more digestible without altering it in a bigger way (like doing a log transform). $\endgroup$
    – Quasar
    Apr 22, 2016 at 15:49
  • 2
    $\begingroup$ @German "In general" the answer is yes! When the units in which we measure a variable are arbitrary--pounds or drams, angstroms or parsecs--then scaling the variable is an essential mechanism to convert between units. Only when the units have intrinsic meaning (such as counts) would the meaningfulness of scaling be questionable. $\endgroup$
    – whuber
    Apr 22, 2016 at 16:23
  • 2
    $\begingroup$ I think I would agree with you, @German, understanding that by "z-score" you mean computing a standardized value with the intention of referring it to a standard Normal distribution. But the current question appears to comprise a large set of more benign applications, ranging from standardizing regression residuals, to understanding correlation in terms of mean products of standardized variables, to stabilizing numerical algorithms, and many more situations where the Normal distribution is neither used nor considered relevant. $\endgroup$
    – whuber
    Apr 22, 2016 at 22:09

1 Answer 1

1
$\begingroup$

Scaling a variable is a linear transformation and it will not change the distribution of the variable so it does not matter if the variable has a non-normal distribution.

You can confirm this by generating non-normally distributed data in R, such as: X=rnorm(10000,10,5)^2. Then, scale the variable "X" X.z = scale(x)

Comparing the two histograms: hist(X) vs. hist(X.z) you'll see the distributions are unchanged.

EDIT: As noted in the comments, scaling does influence the interpretation of the parameters when doing many statistical analyses (regression, PCA etc) so the decision to scale should be based on how you want to interpret your parameters.

However, scaling will not change the underlying distribution of the variable nor will it influence (positively or negatively) the violations of model assumptions. For example, an assumption of linear regression is normality of the residuals scaling a raw variable will not affect this normality.

$\endgroup$
2
  • 1
    $\begingroup$ Although the shapes of distributions are unchanged by scaling, the distributions themselves are definitely changed. This might sound like a nit-pick until you contemplate operations like scaling a Poisson distribution: suddenly it's no longer a Poisson distribution at all. $\endgroup$
    – whuber
    Apr 22, 2016 at 16:25
  • $\begingroup$ If isn't a normal distribution, it isn't right to apply a scaling before a Principal Component Analisys process. $\endgroup$
    – ndrini
    Apr 27, 2016 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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