# Measure dependence/correlation of two variables in a multivariate setting

In a generalized setting, we have a dataset $\{y, x_1, x_2, x_3\}$ where I want to measure if $x_2$ has any correlation with $y$. There are couple of caveats,

1. $x_1, x_2, x_3$ themselves can be collinear or not
2. There can be other predictive variables $x_4$, $x_5$ which are not included in the dataset and have the most impact on $y$.

Given the above setting how do we test/measure for any dependency for $y$ and say $x_2$?

If you just want to tell if $$x_2$$ has any correlation with $$y$$, you should just run a regression of $$y$$ on $$x_2$$ and test for significance of slope (or regression) - most statistical packages will automatically yield a p-value along with slope.

Please notice that that can be very different that checking for significance of one explanatory variable when other variables are included.

For example, let's consider the following variables:

• $$y$$ : times a car wheel spins in a journey.
• $$x_1$$: length (in km) of journey.
• $$x_2$$: duration (in hours) of journey.

Obviously, $$y$$ and $$x_2$$ are correlated, but correlation will be more stronger between $$y$$ and $$x_1$$. Therefore, performing a regression analysis of $$y$$ on $$x_2$$ will give a significant correlation, but performing a multiple regression analysis of $$y$$ on $$x_1$$ and $$x_2$$ will show that influence of $$x_2$$ won't be significant when considered with $$x_1$$. That is, journeys that take more time then to produce more turns of wheel; however, journeys that take different times but are of the same length (in km) produce the same number of wheel turns.

On a more extreme end, you may be interested in knowing how are $$y$$ and $$x_2$$ when the effects all other predictors (or just some of them) are removed. That is partial correlation.

Then, your choice between single or multiple regression should be governed by what you want to do with the result of your analysis. If you were just wanting to produce predictions as accurate as possible, sticking with multiple regression is often a good idea.

• The text text just ended without finnish – kjetil b halvorsen May 20 '19 at 22:48
• @kjetilbhalvorsen - Thanks for noticing. I tried to guess what I wanted to say three years ago. – Pere May 20 '19 at 23:00