4
$\begingroup$

I have created the following graph which contains a great number of datapoints, I can see that there is a very linear scattering of the points, but am not sure since it displays a lot of datapoints all around the graph. Could anyone explain what kind of relationship is present and their technique for identifying it?

graph

$\endgroup$
  • 1
    $\begingroup$ Google "linear regression." It is a vast topic. $\endgroup$ – John Coleman Apr 21 '17 at 3:14
  • $\begingroup$ This is clearly not linear... $\endgroup$ – SmallChess Apr 21 '17 at 3:45
  • 1
    $\begingroup$ @SmallChess unfortunately I cant see that as clearly, how would you suggest I learn to either calculate or determine that? $\endgroup$ – LoriDori Apr 21 '17 at 4:00
  • 2
    $\begingroup$ @SmallChess Disagree. It's certainly not "clear" that a non-linear realationship would explain this data better than a linear one. $\endgroup$ – TrynnaDoStat Apr 21 '17 at 15:12
3
$\begingroup$

There is some correlation, but it is weak. You could calculate this with the cor() function.

Add + geom_smooth(method = "lm") to your ggplot to see the relationship.

Finally, I think this is showing Heteroscedasticity - https://en.m.wikipedia.org/wiki/Heteroscedasticity

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ You seem to be advocating correlation as the go-to method to characterize this scatterplot. But in light of the heteroscedasticity (and some curvilinearity), why bother? Of what possible value could the correlation coefficient be? $\endgroup$ – whuber Apr 21 '17 at 14:01
3
$\begingroup$

It's impossible to give you a definitive answer. It's possible that the relationship is linearizable though. Look at the MATLAB code and the graph below:

x=randi(1000,10000,1);
y=arrayfun(@(lambda)nbinrnd(lambda/200,0.001)/10,x);
scatter(x,y)

This is a simulation of the negative binomial distribution where one of the parameters is proportional on x-axis variable. It looks similar to your plot.

enter image description here

| cite | improve this answer | |
$\endgroup$
1
$\begingroup$

To me the data looks linear. There are tests of linearity, look at: https://stats.stackexchange.com/questions/68454/statistical-test-to-see-if-relationship-is-linear-or-non-linear

Personally, I'd just use a qqplot, it's a quick and easy way to visualize how linear a dataset it by comparing the distributions of the 2 variables together (see ?qqplot) or this for an explanation: https://en.wikipedia.org/wiki/Q–Q_plot.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ A quantile-quantile plot can't be more informative, and more reliably informative, than a scatter plot about relationships. Wanting to get rid of noise is understandable but there are better ways of doing that. $\endgroup$ – Nick Cox Apr 21 '17 at 14:06
1
$\begingroup$

A linear relationship can still have large error around the regression line which your data seems to have for certain ranges of $X$. This happens when $X$ tells you something about $Y$ but doesn't fully explain values of $Y$. This happens all the time! For example, height explains weight but doesn't 100% tell you what a person's weight will be.

A linear relationship does seem to give you an adequate explanation of the general relationship between $X$ and $Y$ in your scatterplot. At least, it's not clear to me that a non-linear term would do a better job explaining this data than simply a linear one. What you don't appear to have is Normally distributed error with constant variance in $X$. You certainly have heteroskedasticity because the error around the would-be linear regression line varies for different regions of $X$. This violates an assumption of ordinary least squares (OLS) regression.

Since you are violating an assumption of OLS, do not estimate the parameters of your linear relationship using OLS (which many software treats as default). Instead, you can handle the heteroskedasticity with weighted least squares. Additionally, you ought to consider modeling your error as non-Normal because it's not obvious to me whether or not you error is Normal (so consider things like a qq-plot to check).

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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