Search code examples
rnonlinear-functions

Non-graphical linearity estimation


In my previous post, I was looking for correlation ratio (η or η2) routines in R. I was surprised by the fact that no one uses η for linearity checking in the GLM procedures.

How can I check linearity of bivariate correlation? Solely with scatterplot?

There are several ways of doing this, one way is to compare linear and non-linear model R2, then to apply F test to seek for significant difference between them.

How can I check linearity, the "non-grafical" way?


Solution

  • An answer is what exactly you have said (comparing a linear and a non-linear model). e.g.

    model1<-lm(yv~xv)
    model2<-lm(yv~xv+I(xv^2)) #Even if we restrict ourselves to the inclusion of a quadratic term, there are many curves we can describe, depending upon the signs of the linear and quadratic terms
    
    anova(model1,model2)
    
    Analysis of Variance Table
    
    Model 1: yv ~ xv
    Model 2: yv ~ xv + I(xv^2)
      Res.Df    RSS Df Sum of Sq      F Pr(>F)  
    1     16 91.057                             
    2     15 68.143  1    22.915 5.0441 0.0402 *
    

    The more complicated curved model is a significant improvement over the linear model (p=0.04) so, in that case, we accept that there is evidence of curvature in the data.