# Covariance between variables

When looking at correlation, some variables may have a higher correlation but others may have a stronger relationship between them and a lower correlation. What do you do to figure out which variables have a stronger relationship?

So when two stocks move together, Stock A and Stock B may have very high correlation because they vary strongly together in up and down days.

But what if you have a lower correlation for two stocks, where one stock varies strongly and the other not as much, but in a more predictable fashion. So conditional on Stock A you can guess Stock B will always be 50% of the variance exactly.

So the first pair is not as predictable but higher correlation. And next pair is more predictable and lower correlation.

How can I solve which is has a stronger relationship?

******** I have used the incorrect term correlation instead of covariance. Wherever it says correlation I mean COVARIANCE. I have now realised that 'Correlation' solves the problem.

• " others may have a stronger relationship between them and a lower correlation." Can you give example for this? Apr 17, 2015 at 6:11
• I think my question will be answered once I move onto and understand linear regression. After reading through regression it seems that this is the answer. It seems correlation measures the strength of how variables vary together, while regression will measure how predictable y is given a certain value of x has occurred. So two variables may have stronger correlation but lower value relationship in regression, and vice versa... Does this sound correct? Sorry I have not done linear regression yet so It could be my gap in understanding
– Will
Apr 17, 2015 at 6:27
• @Will it is not clear what is the difference between two cases you described. Could you give an example (e.g. a data sample or a plot)? Univariate linear regression gives you the same results as correlation, so using blindly regression instead of correlation won't do much help in here.
– Tim
Apr 17, 2015 at 13:44

"Higher the absolute correlation, stronger the relation."

Yes! learn linear regression, then you can test whether the relation is significantly wrong.

Tests:

1. test $\beta$ by t-test$$t_{n-2}\sim \frac{\hat \beta-\beta}{\sqrt{\frac{\hat \sigma^2}{S_{xx}}}}$$
2. Fisher Z test$${tanh}^{-1}r\sim N({tanh}^{-1}\rho,(n-3)^{-1})$$
• Could you elaborate on how and why in your opinion linear regression solves the problem described in the question? p-values in correlation also tell you if the relationship is significantly different from 0, so using regression rather then correlation does not change anything in here.
– Tim
Apr 17, 2015 at 13:37
• Please see edit. Apr 17, 2015 at 15:15
• This does not answer both my questions and the one in the initial question. You do not answer why regression would work any better than correlation in here.
– Tim
Apr 17, 2015 at 15:23
• at least I gave you for 'how' as OP said "conditional on Stock A you can guess Stock B", stocks linear relation. and even if you want to test sway from $\rho$ fitting regression,use Fisher-Z Apr 17, 2015 at 15:34
• But you get the same information with correlation so this does not really change anything for OP.
– Tim
Apr 17, 2015 at 15:39

If you're talking about correlation between predictor variables in a regression model, then the phenomenon you're describing is referred to as multicollinearity. In order to detect multicollinearity, as a minimum, you have to calculate variance inflation factor (VIF), but there are other tests for this task as well. While detecting multicollinearity is relatively easy, dealing with it is not. Therefore, it might be beneficial to prevent it prior analysis or, at least, reduce it during the analysis. For more information on preventing and reducing multicollinearity, check my relevant answer.

• I wonder why this answer was downvoted..?
– Tim
Apr 17, 2015 at 16:22
• @Tim: Me, too :-). To downvoter: care to share your arguments? Apr 17, 2015 at 16:22
• Hi, thank you for the answer. We will be getting to multicollinearity in class at a later date so I am not aware of the topic. But I have read a few pages and by my understanding it is when two independant variables are so highly correlated it is hard to detect effect of each variable on the dependant variable? What I was trying to say in my original question I think I have figured out and it was a stupid question on my part. I will write it as an answer because I may not be able to fit it in this comment. Could you please take a look and confirm or comment on my answer!!! Cheers
– Will
Apr 18, 2015 at 2:22
• @Will: You are welcome. I'm not an expert on the topic, but will take a look at your answer, when it'll be available, and share my feedback. There might be some delay, though, as I will be busy until the end of the next week. Apr 18, 2015 at 2:59
• @AleksandrBlekh no worries. I just posted my answer then, I used correlation incorrectly so I confused everyone.
– Will
Apr 18, 2015 at 3:15

So the original question I should have worded like this.

Say your looking at a stock, Stock A, and want to find one other stock that has as close as possible linear relationship to that stock. So you look at the relationship between Stock A and another stock from the same sector, Stock B. You find that they have strong covariance because when stock A goes up 6% Stock B goes up 5%, then Stock A 8% and Stock B 8.5% etc, so they vary strongly together and have a high covariance.

Now you want to test Stock A against another Stock to see if it is perhaps better than the Stock B. So you look at Stock A compared to another stock in the same sector, Stock C. Now when Stock A rises 6% Stock C only rises 3%, so they don't vary as strongly together as Stock A and Stock B, so the covariance is not as high. But you notice if stock A rises 4% Stock C will rise 2% and will always maintain that predictable pattern. So although Stock A and Stock B vary at a higher amount together, Stock A and Stock C are more predictable in nature.

Now to answer this question I have concluded that to find the better linear relationship we need to normalise the distributions. Stock A and Stock B have a very similar distribution, so when Stock A goes up 8% say 2 standard deviations away from the mean, then Stock B will also rise by around 8% about 2 standard deviations away from mean.

Stock A and Stock B have a more widely distributed frequency of returns, so the distributions of Stock A and Stock B are almost identical. Stock C does not have a similar looking distribution, it is not as volatile as Stock A, so it will not vary as much as Stock A does in percentage growth e.g. 8% gain. But it will always be half of what Stock A return is.

So by normalising the distribution of returns to fit the same units I would find that Stock A and Stock C actually have a more linear and predictable relationship. The behaviour of stock A and Stock B is almost the same but not as predictable, the behaviour of Stock A and Stock C is not obvious straight away from covariance but is infact more linear.

By normalising the covariance of the two Stocks through the correlation coefficient, I change both stocks to similar units so I do not have the error of covariance which may give a false impression of which Stock has a stronger relationship due to face value of similar distributions.

Sorry for the stupid question in the first place.. I was not using the term Covariance correctly. Please confirm or add anything of value to this answer!?!?

Cheers, Will