Check if dependency between two variables is linearIs $R^2$ useful or dangerous?What is the relationship between R-squared and p-value in a regression?How to check my data set is following non-linear to linear regression?How to prove linearity assumption in regression analysis for a continuous dependent and nominal independent variable?what does linear regression actually mean?Linear regression with depended predictor variables

Coupling two 15 Amp circuit breaker for 20 Amp

What caused the end of cybernetic implants?

How do you say "half the time …, the other half …" in German?

Historical Daf Yomi calendar

Why can't miners meet the difficulty by picking a low number for the block hash?

having problems with greek characters in a table using csvsimple

“I hope he visit us more often” Why is this wrong?

Answer with an image of my favorite musician

Is it recommended to point out a professor's mistake during their lecture?

RAID0 instead of RAID1 or 5, is this crazy?

In Endgame, wouldn't Stark have remembered Hulk busting out of the stairwell?

'Horseshoes' for Deer?

basename "$0" not working

Is there an in-universe explanation given to the senior Imperial Navy Officers as to why Darth Vader serves Emperor Palpatine?

How can I reply to coworkers who accuse me of automating people out of work?

Why is 3/4 a simple meter while 6/8 is a compound meter?

What does "-1" represent in the value range for unsigned int and signed int?

How to handle inventory and story of a player leaving

What is the following VRP?

Why are JWST optics not enclosed like HST?

Idiomatic way to create an immutable and efficient class in C++?

Why do presidential pardons exist in a country having a clear separation of powers?

Is this position a forced win for Black after move 14?

Which polygons can be turned inside out by a smooth deformation?



Check if dependency between two variables is linear


Is $R^2$ useful or dangerous?What is the relationship between R-squared and p-value in a regression?How to check my data set is following non-linear to linear regression?How to prove linearity assumption in regression analysis for a continuous dependent and nominal independent variable?what does linear regression actually mean?Linear regression with depended predictor variables






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3












$begingroup$


There are a number of values for dependent variable (let's name it Y) and the same number of corresponding values for independent variable (let's name it X).



enter image description here
How can i check if dependency Y(X) is linear?
If my table would looks like (i.e. independent variable X will take only two values 0 or 1):
enter image description here



Is it possible in that case that dependency Y(X) is linear? Why?










share|cite|improve this question









$endgroup$









  • 1




    $begingroup$
    You should say what you mean by a linear relationship. Ordinarily, one says that ordinary (Pearson) correlation measures the linear component of association. So $|r|$ sufficiently near $1$ might be a criterion for linearity. // In your first dataset relationship seems linear, but not in the second. // I can't easily convert your 'pictures' to numbers, so I didn't actually find correlations for either.
    $endgroup$
    – BruceET
    8 hours ago






  • 1




    $begingroup$
    @Bruce Only some people make that claim about $|r|.$ I think it's overblown and misleading. A different interpretation of "linearity" is that alternative non-linear models aren't worth the additional complexity. There are two standard, textbook approaches to this: add a quadratic term or bin the independent variable(s). Run an ANOVA on the nested model. If it's not significant, conclude you haven't detected any nonlinearity. These are often called "goodness of fit" tests (which you surely know, but many of our visitors do not).
    $endgroup$
    – whuber
    7 hours ago










  • $begingroup$
    Thanks for link.
    $endgroup$
    – BruceET
    7 hours ago










  • $begingroup$
    @BruceET In the protocol i'm going to apply was mentioned: Note that if observations are, instead, linearly related to gradients, we have to use a Canonical Correlation Analysis (CANCOR) or Redundancy Analysis (RDA) instead of a Canonical Correspondence Analysis (CCA). So i'm not sure which definition author exactly mean.
    $endgroup$
    – Denis
    7 hours ago











  • $begingroup$
    @ whuber Thanks a lot. Could you provide some tutorial for these two methods (add a quadratic term and bin the independent variable) you mentioned please (if possible in r). I'm not a statistician and it's not easy to figure out that. What i already understand now from your post i have to make some linear models (perhaps with lm function) and then test them with ANOVA. But it's not clear which models i could make with one independent variable. Thank you again.
    $endgroup$
    – Denis
    4 hours ago

















3












$begingroup$


There are a number of values for dependent variable (let's name it Y) and the same number of corresponding values for independent variable (let's name it X).



enter image description here
How can i check if dependency Y(X) is linear?
If my table would looks like (i.e. independent variable X will take only two values 0 or 1):
enter image description here



Is it possible in that case that dependency Y(X) is linear? Why?










share|cite|improve this question









$endgroup$









  • 1




    $begingroup$
    You should say what you mean by a linear relationship. Ordinarily, one says that ordinary (Pearson) correlation measures the linear component of association. So $|r|$ sufficiently near $1$ might be a criterion for linearity. // In your first dataset relationship seems linear, but not in the second. // I can't easily convert your 'pictures' to numbers, so I didn't actually find correlations for either.
    $endgroup$
    – BruceET
    8 hours ago






  • 1




    $begingroup$
    @Bruce Only some people make that claim about $|r|.$ I think it's overblown and misleading. A different interpretation of "linearity" is that alternative non-linear models aren't worth the additional complexity. There are two standard, textbook approaches to this: add a quadratic term or bin the independent variable(s). Run an ANOVA on the nested model. If it's not significant, conclude you haven't detected any nonlinearity. These are often called "goodness of fit" tests (which you surely know, but many of our visitors do not).
    $endgroup$
    – whuber
    7 hours ago










  • $begingroup$
    Thanks for link.
    $endgroup$
    – BruceET
    7 hours ago










  • $begingroup$
    @BruceET In the protocol i'm going to apply was mentioned: Note that if observations are, instead, linearly related to gradients, we have to use a Canonical Correlation Analysis (CANCOR) or Redundancy Analysis (RDA) instead of a Canonical Correspondence Analysis (CCA). So i'm not sure which definition author exactly mean.
    $endgroup$
    – Denis
    7 hours ago











  • $begingroup$
    @ whuber Thanks a lot. Could you provide some tutorial for these two methods (add a quadratic term and bin the independent variable) you mentioned please (if possible in r). I'm not a statistician and it's not easy to figure out that. What i already understand now from your post i have to make some linear models (perhaps with lm function) and then test them with ANOVA. But it's not clear which models i could make with one independent variable. Thank you again.
    $endgroup$
    – Denis
    4 hours ago













3












3








3





$begingroup$


There are a number of values for dependent variable (let's name it Y) and the same number of corresponding values for independent variable (let's name it X).



enter image description here
How can i check if dependency Y(X) is linear?
If my table would looks like (i.e. independent variable X will take only two values 0 or 1):
enter image description here



Is it possible in that case that dependency Y(X) is linear? Why?










share|cite|improve this question









$endgroup$




There are a number of values for dependent variable (let's name it Y) and the same number of corresponding values for independent variable (let's name it X).



enter image description here
How can i check if dependency Y(X) is linear?
If my table would looks like (i.e. independent variable X will take only two values 0 or 1):
enter image description here



Is it possible in that case that dependency Y(X) is linear? Why?







r regression






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked 8 hours ago









DenisDenis

837 bronze badges




837 bronze badges










  • 1




    $begingroup$
    You should say what you mean by a linear relationship. Ordinarily, one says that ordinary (Pearson) correlation measures the linear component of association. So $|r|$ sufficiently near $1$ might be a criterion for linearity. // In your first dataset relationship seems linear, but not in the second. // I can't easily convert your 'pictures' to numbers, so I didn't actually find correlations for either.
    $endgroup$
    – BruceET
    8 hours ago






  • 1




    $begingroup$
    @Bruce Only some people make that claim about $|r|.$ I think it's overblown and misleading. A different interpretation of "linearity" is that alternative non-linear models aren't worth the additional complexity. There are two standard, textbook approaches to this: add a quadratic term or bin the independent variable(s). Run an ANOVA on the nested model. If it's not significant, conclude you haven't detected any nonlinearity. These are often called "goodness of fit" tests (which you surely know, but many of our visitors do not).
    $endgroup$
    – whuber
    7 hours ago










  • $begingroup$
    Thanks for link.
    $endgroup$
    – BruceET
    7 hours ago










  • $begingroup$
    @BruceET In the protocol i'm going to apply was mentioned: Note that if observations are, instead, linearly related to gradients, we have to use a Canonical Correlation Analysis (CANCOR) or Redundancy Analysis (RDA) instead of a Canonical Correspondence Analysis (CCA). So i'm not sure which definition author exactly mean.
    $endgroup$
    – Denis
    7 hours ago











  • $begingroup$
    @ whuber Thanks a lot. Could you provide some tutorial for these two methods (add a quadratic term and bin the independent variable) you mentioned please (if possible in r). I'm not a statistician and it's not easy to figure out that. What i already understand now from your post i have to make some linear models (perhaps with lm function) and then test them with ANOVA. But it's not clear which models i could make with one independent variable. Thank you again.
    $endgroup$
    – Denis
    4 hours ago












  • 1




    $begingroup$
    You should say what you mean by a linear relationship. Ordinarily, one says that ordinary (Pearson) correlation measures the linear component of association. So $|r|$ sufficiently near $1$ might be a criterion for linearity. // In your first dataset relationship seems linear, but not in the second. // I can't easily convert your 'pictures' to numbers, so I didn't actually find correlations for either.
    $endgroup$
    – BruceET
    8 hours ago






  • 1




    $begingroup$
    @Bruce Only some people make that claim about $|r|.$ I think it's overblown and misleading. A different interpretation of "linearity" is that alternative non-linear models aren't worth the additional complexity. There are two standard, textbook approaches to this: add a quadratic term or bin the independent variable(s). Run an ANOVA on the nested model. If it's not significant, conclude you haven't detected any nonlinearity. These are often called "goodness of fit" tests (which you surely know, but many of our visitors do not).
    $endgroup$
    – whuber
    7 hours ago










  • $begingroup$
    Thanks for link.
    $endgroup$
    – BruceET
    7 hours ago










  • $begingroup$
    @BruceET In the protocol i'm going to apply was mentioned: Note that if observations are, instead, linearly related to gradients, we have to use a Canonical Correlation Analysis (CANCOR) or Redundancy Analysis (RDA) instead of a Canonical Correspondence Analysis (CCA). So i'm not sure which definition author exactly mean.
    $endgroup$
    – Denis
    7 hours ago











  • $begingroup$
    @ whuber Thanks a lot. Could you provide some tutorial for these two methods (add a quadratic term and bin the independent variable) you mentioned please (if possible in r). I'm not a statistician and it's not easy to figure out that. What i already understand now from your post i have to make some linear models (perhaps with lm function) and then test them with ANOVA. But it's not clear which models i could make with one independent variable. Thank you again.
    $endgroup$
    – Denis
    4 hours ago







1




1




$begingroup$
You should say what you mean by a linear relationship. Ordinarily, one says that ordinary (Pearson) correlation measures the linear component of association. So $|r|$ sufficiently near $1$ might be a criterion for linearity. // In your first dataset relationship seems linear, but not in the second. // I can't easily convert your 'pictures' to numbers, so I didn't actually find correlations for either.
$endgroup$
– BruceET
8 hours ago




$begingroup$
You should say what you mean by a linear relationship. Ordinarily, one says that ordinary (Pearson) correlation measures the linear component of association. So $|r|$ sufficiently near $1$ might be a criterion for linearity. // In your first dataset relationship seems linear, but not in the second. // I can't easily convert your 'pictures' to numbers, so I didn't actually find correlations for either.
$endgroup$
– BruceET
8 hours ago




1




1




$begingroup$
@Bruce Only some people make that claim about $|r|.$ I think it's overblown and misleading. A different interpretation of "linearity" is that alternative non-linear models aren't worth the additional complexity. There are two standard, textbook approaches to this: add a quadratic term or bin the independent variable(s). Run an ANOVA on the nested model. If it's not significant, conclude you haven't detected any nonlinearity. These are often called "goodness of fit" tests (which you surely know, but many of our visitors do not).
$endgroup$
– whuber
7 hours ago




$begingroup$
@Bruce Only some people make that claim about $|r|.$ I think it's overblown and misleading. A different interpretation of "linearity" is that alternative non-linear models aren't worth the additional complexity. There are two standard, textbook approaches to this: add a quadratic term or bin the independent variable(s). Run an ANOVA on the nested model. If it's not significant, conclude you haven't detected any nonlinearity. These are often called "goodness of fit" tests (which you surely know, but many of our visitors do not).
$endgroup$
– whuber
7 hours ago












$begingroup$
Thanks for link.
$endgroup$
– BruceET
7 hours ago




$begingroup$
Thanks for link.
$endgroup$
– BruceET
7 hours ago












$begingroup$
@BruceET In the protocol i'm going to apply was mentioned: Note that if observations are, instead, linearly related to gradients, we have to use a Canonical Correlation Analysis (CANCOR) or Redundancy Analysis (RDA) instead of a Canonical Correspondence Analysis (CCA). So i'm not sure which definition author exactly mean.
$endgroup$
– Denis
7 hours ago





$begingroup$
@BruceET In the protocol i'm going to apply was mentioned: Note that if observations are, instead, linearly related to gradients, we have to use a Canonical Correlation Analysis (CANCOR) or Redundancy Analysis (RDA) instead of a Canonical Correspondence Analysis (CCA). So i'm not sure which definition author exactly mean.
$endgroup$
– Denis
7 hours ago













$begingroup$
@ whuber Thanks a lot. Could you provide some tutorial for these two methods (add a quadratic term and bin the independent variable) you mentioned please (if possible in r). I'm not a statistician and it's not easy to figure out that. What i already understand now from your post i have to make some linear models (perhaps with lm function) and then test them with ANOVA. But it's not clear which models i could make with one independent variable. Thank you again.
$endgroup$
– Denis
4 hours ago




$begingroup$
@ whuber Thanks a lot. Could you provide some tutorial for these two methods (add a quadratic term and bin the independent variable) you mentioned please (if possible in r). I'm not a statistician and it's not easy to figure out that. What i already understand now from your post i have to make some linear models (perhaps with lm function) and then test them with ANOVA. But it's not clear which models i could make with one independent variable. Thank you again.
$endgroup$
– Denis
4 hours ago










1 Answer
1






active

oldest

votes


















3













$begingroup$

Sometimes a simple scatterplot alone is sufficient to make this determination. If the relationship is linear, I would expect a scatterplot of the data to show the data somewhat evenly scattered about a straight line - here, this is not the case, as the shape of the data from the first table has obvious curvature:



plot



As an simple example equation that would fit this curvature, here is a hyperbolic type equation "y = (a + (b * x)) / (c + x)" fitted to the data:



curved



and here is a straight line "y = a + (b * x)" fitted to the data:



straight






share|cite|improve this answer









$endgroup$














  • $begingroup$
    I'm wondering if it's possible in theory to have a linear dependency between X and Y if X take only two possible values 0 or 1?
    $endgroup$
    – Denis
    4 hours ago










  • $begingroup$
    In trivially simple cases yes, for example a data set with only two points such as [0, 5] and [1, 10]. A scatterplot of those two points will show that a straight line could trivially be made between them. However if you scatter plot the data in your second table, you should see that a straight line model is not going to fit that data at all - those data points do not lie on anything even close to a straight line.
    $endgroup$
    – James Phillips
    7 mins ago













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "65"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f424202%2fcheck-if-dependency-between-two-variables-is-linear%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3













$begingroup$

Sometimes a simple scatterplot alone is sufficient to make this determination. If the relationship is linear, I would expect a scatterplot of the data to show the data somewhat evenly scattered about a straight line - here, this is not the case, as the shape of the data from the first table has obvious curvature:



plot



As an simple example equation that would fit this curvature, here is a hyperbolic type equation "y = (a + (b * x)) / (c + x)" fitted to the data:



curved



and here is a straight line "y = a + (b * x)" fitted to the data:



straight






share|cite|improve this answer









$endgroup$














  • $begingroup$
    I'm wondering if it's possible in theory to have a linear dependency between X and Y if X take only two possible values 0 or 1?
    $endgroup$
    – Denis
    4 hours ago










  • $begingroup$
    In trivially simple cases yes, for example a data set with only two points such as [0, 5] and [1, 10]. A scatterplot of those two points will show that a straight line could trivially be made between them. However if you scatter plot the data in your second table, you should see that a straight line model is not going to fit that data at all - those data points do not lie on anything even close to a straight line.
    $endgroup$
    – James Phillips
    7 mins ago















3













$begingroup$

Sometimes a simple scatterplot alone is sufficient to make this determination. If the relationship is linear, I would expect a scatterplot of the data to show the data somewhat evenly scattered about a straight line - here, this is not the case, as the shape of the data from the first table has obvious curvature:



plot



As an simple example equation that would fit this curvature, here is a hyperbolic type equation "y = (a + (b * x)) / (c + x)" fitted to the data:



curved



and here is a straight line "y = a + (b * x)" fitted to the data:



straight






share|cite|improve this answer









$endgroup$














  • $begingroup$
    I'm wondering if it's possible in theory to have a linear dependency between X and Y if X take only two possible values 0 or 1?
    $endgroup$
    – Denis
    4 hours ago










  • $begingroup$
    In trivially simple cases yes, for example a data set with only two points such as [0, 5] and [1, 10]. A scatterplot of those two points will show that a straight line could trivially be made between them. However if you scatter plot the data in your second table, you should see that a straight line model is not going to fit that data at all - those data points do not lie on anything even close to a straight line.
    $endgroup$
    – James Phillips
    7 mins ago













3














3










3







$begingroup$

Sometimes a simple scatterplot alone is sufficient to make this determination. If the relationship is linear, I would expect a scatterplot of the data to show the data somewhat evenly scattered about a straight line - here, this is not the case, as the shape of the data from the first table has obvious curvature:



plot



As an simple example equation that would fit this curvature, here is a hyperbolic type equation "y = (a + (b * x)) / (c + x)" fitted to the data:



curved



and here is a straight line "y = a + (b * x)" fitted to the data:



straight






share|cite|improve this answer









$endgroup$



Sometimes a simple scatterplot alone is sufficient to make this determination. If the relationship is linear, I would expect a scatterplot of the data to show the data somewhat evenly scattered about a straight line - here, this is not the case, as the shape of the data from the first table has obvious curvature:



plot



As an simple example equation that would fit this curvature, here is a hyperbolic type equation "y = (a + (b * x)) / (c + x)" fitted to the data:



curved



and here is a straight line "y = a + (b * x)" fitted to the data:



straight







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered 7 hours ago









James PhillipsJames Phillips

8113 gold badges7 silver badges7 bronze badges




8113 gold badges7 silver badges7 bronze badges














  • $begingroup$
    I'm wondering if it's possible in theory to have a linear dependency between X and Y if X take only two possible values 0 or 1?
    $endgroup$
    – Denis
    4 hours ago










  • $begingroup$
    In trivially simple cases yes, for example a data set with only two points such as [0, 5] and [1, 10]. A scatterplot of those two points will show that a straight line could trivially be made between them. However if you scatter plot the data in your second table, you should see that a straight line model is not going to fit that data at all - those data points do not lie on anything even close to a straight line.
    $endgroup$
    – James Phillips
    7 mins ago
















  • $begingroup$
    I'm wondering if it's possible in theory to have a linear dependency between X and Y if X take only two possible values 0 or 1?
    $endgroup$
    – Denis
    4 hours ago










  • $begingroup$
    In trivially simple cases yes, for example a data set with only two points such as [0, 5] and [1, 10]. A scatterplot of those two points will show that a straight line could trivially be made between them. However if you scatter plot the data in your second table, you should see that a straight line model is not going to fit that data at all - those data points do not lie on anything even close to a straight line.
    $endgroup$
    – James Phillips
    7 mins ago















$begingroup$
I'm wondering if it's possible in theory to have a linear dependency between X and Y if X take only two possible values 0 or 1?
$endgroup$
– Denis
4 hours ago




$begingroup$
I'm wondering if it's possible in theory to have a linear dependency between X and Y if X take only two possible values 0 or 1?
$endgroup$
– Denis
4 hours ago












$begingroup$
In trivially simple cases yes, for example a data set with only two points such as [0, 5] and [1, 10]. A scatterplot of those two points will show that a straight line could trivially be made between them. However if you scatter plot the data in your second table, you should see that a straight line model is not going to fit that data at all - those data points do not lie on anything even close to a straight line.
$endgroup$
– James Phillips
7 mins ago




$begingroup$
In trivially simple cases yes, for example a data set with only two points such as [0, 5] and [1, 10]. A scatterplot of those two points will show that a straight line could trivially be made between them. However if you scatter plot the data in your second table, you should see that a straight line model is not going to fit that data at all - those data points do not lie on anything even close to a straight line.
$endgroup$
– James Phillips
7 mins ago

















draft saved

draft discarded
















































Thanks for contributing an answer to Cross Validated!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f424202%2fcheck-if-dependency-between-two-variables-is-linear%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу