I was going through the assumptions of linear regression and of course one of them was linearity between the dependent and the independent variables - to be precise I should say that the assumption is the conditional mean of $Y_i$ given $X_i$ is linear in the parameters.

I looked in many textbooks and resources online and all of them suggested to check that assumption through a scatter plot of the residuals versus the fitted values. Although I can see that this is a valid and helpful way, I can't help but notice that it can be a bit arbitrary and subjective in some cases.

My question is if there is a statistical test to examine that assumption as well. For example when testing heteroscedasticity we can see the residual plot but we also have Levene's test.

I can see in that in How can I use the value of $R^2$ to test the linearity assumption in multiple regression analysis? ,which is very helpful, it stated the R squared is not that statistic but doesn't mention anything as a viable alternative.

Thanks in advance

  • 1
    $\begingroup$ One cannot get away from arbitrariness and subjectivity with data analysis. Take a statistical test, what justification is there for selecting a specific alpha level? Or take the answer you have there by @DimitriRizopoulos (which I +1), there are other methods to specify non linear relationships; why not those? For one, everyone is limited in their knowledge of all the available options, adding subjectivity to the process. $\endgroup$ Oct 6, 2018 at 22:39
  • 2
    $\begingroup$ I agree completely - I also like that you brought the alpha level as an example as I often use it in similar arguments. Of course I am not trying to find a perfect solution of a magical metric/statistical test that I can feed my data into and it will give me the answer without any doubt. In fact that was why I posted the question as I wanted to expand my knowledge on alternatives to the residual plot, trying to minimise my subjectivity in the matter. Thanks! $\endgroup$ Oct 6, 2018 at 22:52
  • $\begingroup$ I see, awareness of alternatives can be helpful. $\endgroup$ Oct 6, 2018 at 22:55

1 Answer 1


What you can do is fit a model that relaxes the linearity assumption, using, e.g., splines, and compare it with the model that assumes linearity. For example, in R, for a linear regression model you can do something like that:


# linear effect of age on y
fm_linear <- lm(y ~ age + sex, data = your_data)

# nonlinear effect of age on y using natural cubic splines
fm_non_linear <- lm(y ~ ns(age, 3) + sex, data = your_data)

# F-test between the two models
anova(fm_linear, fm_non_linear)
  • 2
    $\begingroup$ Hello Dimitri. Thanks for the quick response. So if I understand it correctly unlike the other assumptions of heteroscedasticity and multicollinearity, which affect the accuracy (for lack of a better word) of the OLS estimators, linearity is an assumptions that refers to the relationship between the dependent and the independent variables. We can still use OLS if it is violated but we should not have a straight line model but rather one with splines and the way to test that would be through ANOVA. Is that a correct conclusion? Also instead of ANOVA could we use the R squared? $\endgroup$ Oct 6, 2018 at 21:30

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.