https://stats.stackexchange.com/que...near/424215?noredirect=1#comment791817_424215

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**).

Below is just toy example:

**X=2,4,7,11,15,20,25,30,33,42,45,50,55,60,70**

Y=0,0,0,0,100,100,200,200,200,500,500,900,950,950,1000

Y=0,0,0,0,100,100,200,200,200,500,500,900,950,950,1000

How can i check if dependency

**Y(X)**is linear?

In addition, i have another theoretical question. If my independent variable (

**X**) is binary, i.e. takes only two values

**0**or

**1**, but

**Y**is discrete (e.g. takes the same values from the example above). Is it possible, that dependency Y(X) is linear? Why?

One from the replies to my question was:

**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**

Unfortunately the reply was not well clear for me. Are there good explanation and tutorial for these two methods (

**add a quadratic term**and

**bin the independent variable**) (if possible in

**r**)? What i already understand i have to make some linear models (perhaps with

**lm**function) and then test them with

**ANOVA**. How many models? It's not clear which models i could make with one independent variable? Could you help please?