# z-score versus log standardisation of stock prices for calculating correlation; which to use (in ML clustering, distance measure)?

I need to compare (get correlation between) different financial instruments (stocks).

The problem is that different stocks will have different price scales.

I was thinking of using z-score standardization on my price time series vectors $\boldsymbol{x_{j}}$:

$$\boldsymbol{x_{j}'} = \frac{\boldsymbol{x_{j}} - \bar{\boldsymbol{x_{j}}}}{\sigma}$$

Now a paper I read uses natural log standardization to achieve the same goal:

$$\boldsymbol{x_{j}''} = ln(\boldsymbol{x_{j}})$$

Is one approach correct and the other incorrect; are both usable, if so which one is preferred and what are the nuances?

Additional info based on answers and comments:

Let me add some context where this is coming from (more of a statistics / machine learning perspective). I want to do classification of different equity markets. Standardisation is a "standard" part of data pre-processing for forecasting or clustering (this is a clustering problem). And I am guessing if I were to use things like expected return and volatility AND Euclidean distance as my measure, it would make sense. However, I have chosen to use correlation as my distance measure. And this is where the question arises. I do not understand why, statistically I should use returns. I can kind of see how z-score is already incorporated into correlation (rather than covariance), although not 100%, not quite sure about log transformation. Since I am doing correlation I am measuring by default the linear relationship; I thought there would be no difference in the linear relationship between X and Y or ln(X) and ln(Y), it just makes sure the scales are the same. But then again the scales do not matter here since we are "standardizing" in the denominator of the correlation equation. Here is the link to the paper that used ln(price).

## 1 Answer

First let me say that correlation between two stocks is almost always taken in return space. First you would transform your price series to a return series and take the correlation.

Now let me address your question about correlations in general. Note the formula for correlation: $$\rho_{XY} = \frac{E[(X-\mu_X)(Y-\mu_Y)]}{\sigma_X\sigma_Y}$$ From this, you can see that correlation is a normalized value that is invariant to scaling/shifting of the inputs. So using your "z-score standardization" method, will actually give you the exact same correlations!

The log standardization will measure the linear relationship between the log transformed variables. You only want to do this if you think there should be a linear relationship between $\textrm{ln}(X)$ and $\textrm{ln}(Y)$.

• Very important point: "the correlation between two stocks is almost always taken in return space. First you would transform your price series to a return series and [then] take the correlation." Mar 30, 2017 at 19:58
• @noob2 My comment was too long so added it to the opening post. Mar 31, 2017 at 7:06
• You are right, standardization does not help. I can better see it in this version of he correlation equation $$\rho(X_{1},X_{2}) = E\Big[ \big( \frac{x_{1} - E(X_{1})}{\sqrt{V(X_{1})}} \big) \big(\frac{x_{2} - E(X_{2})}{\sqrt{V(X_{2})}} \big) \Big]$$. Most papers use log() transformation. I think the reason being making data non-stationary (can't really appreciate why this is important at this moment in time), rather than having data "on same scale" or that "investors work with returns". From my trial and error also noticed that transforming real rather than nominal price makes a difference. Apr 12, 2017 at 7:11