I have a data set where there are two variables X and Y, X being a set of values and Y being a set of corresponding values, like X = [1, 2, 3, 4] and Y = [100, 200, 300, 400].

Ideally I should have a directly proportional relationship. When X increases Y does too, and vice versa. What I would like to do is learn what might be the relationship, is it linear or non-linear or something else. How are such things explored?

More generic question when give two such variables how do you start exploring it?
How to check if there is correlation?

Attaching the scatter plot image enter image description here


3 Answers 3


A correlation implies a $linear$ relationship between two variables, which may not always be the case. See this for an example.

Exploratory graphics are your friend here, I like to plot scatterplots between variables with smoothers to explore relationships initially.


For two variables, you should definitely first plot them and look at them since it is so easy and gives great insight into the data. Humans are great at visually identifying trends. Check to see if the scatter plot is approximately linear first, and then go from there.

  • $\begingroup$ I did this and it is not linear. $\endgroup$
    – gizgok
    Commented Dec 20, 2013 at 22:08
  • $\begingroup$ You could try to linearize it by transforming the response and/or predictors. Or you could try to fit a different kind of model to the data. The former would likely be easier. It's hard to make a suggestion without seeing the data. $\endgroup$
    – Underminer
    Commented Dec 20, 2013 at 22:11
  • $\begingroup$ On second thoughts I think the relationship is linear $\endgroup$
    – gizgok
    Commented Dec 20, 2013 at 22:17
  • 1
    $\begingroup$ @gizgok what made you change your mind from not linear to linear? $\endgroup$
    – develarist
    Commented Sep 2, 2020 at 13:02

Statistician Francis Anscombe demonstrates both the importance of

  1. graphing data before analyzing it, and
  2. checking the effect of outliers and other influential observations on statistical properties

by showing that evaluating data relationships based solely on statistical measures is inadequate compared to preliminary visual inspection. He does this with four different datasets, each consisting of two variables $x$ and $y$, different for each:

Anscbome's Quartet data

Each of the $x$ vectors in the four graphs have the same mean and variance, same goes for the $y$ vectors. Pairwise, $(x,y)$ have the same correlation and regression line in all four graphs.

  1. The first scatter plot (top left) appears to be a simple linear relationship, corresponding to two variables correlated where $y$ could be modelled as gaussian with mean linearly dependent on $x$.
  2. The second graph (top right) is not distributed normally; while a relationship between the two variables is obvious, it is not linear, and the Pearson correlation coefficient is not relevant. A more general regression and the corresponding coefficient of determination would be more appropriate.
  3. In the third graph (bottom left), the distribution is linear, but should have a different regression line (a robust regression would have been called for). The calculated regression is offset by the one outlier which exerts enough influence to lower the correlation coefficient from 1 to 0.816.
  4. Finally, the fourth graph (bottom right) shows an example when one high-leverage point is enough to produce a high correlation coefficient, even though the other data points do not indicate any relationship between the variables.

If there is non-linearity between data series, (Pearson's) correlation is inadequate and other dependence measures such as Spearman's rank correlation and mutual information should be used.


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.