+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 20

Thread: Use of partial regression plots to check for non-linearity

  1. #1
    Fortran must die
    Points: 58,790, Level: 100
    Level completed: 0%, Points required for next Level: 0
    noetsi's Avatar
    Posts
    6,532
    Thanks
    692
    Thanked 915 Times in 874 Posts

    Use of partial regression plots to check for non-linearity




    These are commonly recommended to detect non-linearity in interval level predictors. I ran these in SAS and I have a difficult time interpreting the results [I do not know how to post the pictures generated in SAS to here or I would love to show what I found].

    There is no pattern of non-linearity as discussed in text. No curve at all. But in several cases rather than being spread out horizontally the data goes up in thick vertical column [this is interval data so it spreads out, but the impact is to see a very large column of data rising vertically].

    I have no idea what the data should look like or what indicates non-linearity - and the fact that I have thousands of points which tends to result in blobs makes it harder to analyze.
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  2. #2
    Omega Contributor
    Points: 38,334, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,998
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: Use of partial regression plots to check for non-linearity

    Right click on SAS image, and select copy. Next paste it into Paint and save as Jpeg. Upload picture. I would also be interested in seeing the code used and webpage links.
    Stop cowardice, ban guns!

  3. The Following User Says Thank You to hlsmith For This Useful Post:

    noetsi (03-11-2016)

  4. #3
    Fortran must die
    Points: 58,790, Level: 100
    Level completed: 0%, Points required for next Level: 0
    noetsi's Avatar
    Posts
    6,532
    Thanks
    692
    Thanked 915 Times in 874 Posts

    Re: Use of partial regression plots to check for non-linearity

    What is paint?

    This is the code. Note this generates a huge number of tables which are useless [the graphs are separate from these tables]. There probably needs to be a no print option somewhere, but I think that interferes with ODS so I have no used it [I just delete the useless tables once they run]

    ods graphics on;
    PROC REG DATA=sasuser.perm11


    PLOTS(MAXPOINTS= 11000 ) ;
    Linear_Regression_Model: MODEL DV = Age14 OJT2 timeinserv EDDUM Female Sev1 INCOST Race_W Ethnicity_H Private SEDUM TSA2 CM DD LD OR SE SA
    / SELECTION=NONE


    /* Start of custom user code. */
    partial
    /* End of custom user code. */
    ;
    RUN;
    ods graphics off;
    QUIT;
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  5. The Following User Says Thank You to noetsi For This Useful Post:

    hlsmith (03-12-2016)

  6. #4
    Fortran must die
    Points: 58,790, Level: 100
    Level completed: 0%, Points required for next Level: 0
    noetsi's Avatar
    Posts
    6,532
    Thanks
    692
    Thanked 915 Times in 874 Posts

    Re: Use of partial regression plots to check for non-linearity

    Another formal test is Box Tidwell. You enter the original IV and, for each of these original variables, a transformed variable that is origvariable(log of originalvariable). If the transformed variables are significant when the original variable is in the model than the original variable has a non-linear component. http://www.sagepub.com/upm-data/61117_Chapter_7.pdf
    I did the above test for non-linearity and two of the variables were significant at the .05 level which suggests non-linearity. But I wonder if this might be because power is so strong with 10,000 points....
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  7. #5
    Fortran must die
    Points: 58,790, Level: 100
    Level completed: 0%, Points required for next Level: 0
    noetsi's Avatar
    Posts
    6,532
    Thanks
    692
    Thanked 915 Times in 874 Posts

    Re: Use of partial regression plots to check for non-linearity

    Deleted post by author
    Last edited by noetsi; 03-14-2016 at 09:16 AM.
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  8. #6
    Omega Contributor
    Points: 38,334, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,998
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: Use of partial regression plots to check for non-linearity

    Failed. Use the pretty tree with a light green background button right above where you type.
    Stop cowardice, ban guns!

  9. #7
    Fortran must die
    Points: 58,790, Level: 100
    Level completed: 0%, Points required for next Level: 0
    noetsi's Avatar
    Posts
    6,532
    Thanks
    692
    Thanked 915 Times in 874 Posts

    Re: Use of partial regression plots to check for non-linearity

    Here is it hopefully
    Attached Images  
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  10. #8
    Devorador de queso
    Points: 95,814, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,935
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: Use of partial regression plots to check for non-linearity

    It appears as non-constant variance but what I suspect is really happening is just that you have a much larger sample size in middle area of the graph than on the edges. This can make it appear to cause issues with variance when really all we're seeing is what we would expect (as sample size increases it's not surprising to see more points in the "extremes" just due to chance). But I don't see any issues with linearity in the plot.
    I don't have emotions and sometimes that makes me very sad.

  11. The Following User Says Thank You to Dason For This Useful Post:

    noetsi (03-14-2016)

  12. #9
    Omega Contributor
    Points: 38,334, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,998
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: Use of partial regression plots to check for non-linearity

    Side note, as I have mentioned, I don't typically get many projects that require linear regression. Though, I have been wanting to also write a little piece of code to get loess reg outputs. That way I can look at the linear relationship above, along with an overfitted (lined) relationship.


    Was it Box ~ all models are wrong but some are informative.


    This way I can look at the straight line relationship and the actual varying relationship which may not be monotonic.
    Stop cowardice, ban guns!

  13. #10
    Omega Contributor
    Points: 38,334, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,998
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: Use of partial regression plots to check for non-linearity

    Code: 
    ODS GRAPHICS ON;
    PROC LOESS DATA=Data_set_name;
       MODEL Y = X1/SMOOTH=0.1 0.25 0.4 0.6 RESIDUAL;
    RUN;
    ODS GRAPHICS OFF;
    Stop cowardice, ban guns!

  14. #11
    Fortran must die
    Points: 58,790, Level: 100
    Level completed: 0%, Points required for next Level: 0
    noetsi's Avatar
    Posts
    6,532
    Thanks
    692
    Thanked 915 Times in 874 Posts

    Re: Use of partial regression plots to check for non-linearity

    You put your finger on a key issue to me dason. Its made worse with very large data sets where the shear number of points makes it hard to see anything (unlike the example in text with a few points that make spotting non-linearity fairly easy).

    One limit to this is that I did a box tidwel text (multiplied the variable I suspected on non-linearity by its log and added that to the model for diagnostic reasons only). The new variable was significant, which according to discussions of box tidwel suggests non-linearity. But my power is so huge that I wonder if this is really an issue of non-linearity or of nearly any test being significant [although I did find one variable non-significant]

    Here is a more extreme example, but I think its the same issue. All the data is in a narrow range.
    Attached Images  
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  15. #12
    Omega Contributor
    Points: 38,334, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,998
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: Use of partial regression plots to check for non-linearity

    So you are examining this in logistic model, since you used Tidwell. You new figure seems that your data may be bounded by a floor. This could mislead you, though your plot and the line seem troublesome.
    Stop cowardice, ban guns!

  16. The Following User Says Thank You to hlsmith For This Useful Post:

    noetsi (03-14-2016)

  17. #13
    Fortran must die
    Points: 58,790, Level: 100
    Level completed: 0%, Points required for next Level: 0
    noetsi's Avatar
    Posts
    6,532
    Thanks
    692
    Thanked 915 Times in 874 Posts

    Re: Use of partial regression plots to check for non-linearity

    I did not realize that box tidwel only applied to logistic regression [oops]. Actually I wondered about that since I only saw it used in that case, but no one I read said it did not apply to linear regression.

    The regression is linear not logistic. The reason that the variable is so narrowly focused is that it is cost data and we spend a similar amount on most customers although there are some extreme outliers. Its not really a floor.
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  18. #14
    Fortran must die
    Points: 58,790, Level: 100
    Level completed: 0%, Points required for next Level: 0
    noetsi's Avatar
    Posts
    6,532
    Thanks
    692
    Thanked 915 Times in 874 Posts

    Re: Use of partial regression plots to check for non-linearity

    Anyone know a good test for non-linearity for linear regression that does not involve time series? All the test I have found involve time series data. I have so many points that analysis of the residuals for non-linearity is doubtful.

    I was wondering if any knew if you can use the Ramsey RESET test for non-linearity when you are not utilizing time series data.
    Last edited by noetsi; 03-14-2016 at 12:21 PM.
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  19. #15
    Omega Contributor
    Points: 38,334, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,998
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: Use of partial regression plots to check for non-linearity


    Don't forget my heat map or contour suggestion for seeing trends in big data. I also posted the loess code last weekend. I have no idea if you can apply the box Tidwell to LR, but have never seen it and know it does not have a link function - so I am dubious.
    Stop cowardice, ban guns!

+ Reply to Thread
Page 1 of 2 1 2 LastLast

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats