+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 16 to 25 of 25

Thread: Graphically check linearity in logit regression

  1. #16
    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: Graphically check linearity in logit regression




    A wald test for logistic regression is a test of signficance for a parmater (similar to a t test in linear regression) and that is what I was really pointing out. If a parameter or its interaction term is significant in the wald test it suggests non-linearity.

    Good luck
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  2. #17
    Devorador de queso
    Points: 95,995, 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,938
    Thanks
    307
    Thanked 2,630 Times in 2,246 Posts

    Re: Graphically check linearity in logit regression

    Quote Originally Posted by Phaedrus View Post
    For some reason my previous message does not appear (perhaps it needs to be moderated because I included an attachment?).
    Looks like that was the case - It is approved now though.
    I don't have emotions and sometimes that makes me very sad.

  3. #18
    Points: 19, Level: 1
    Level completed: 37%, Points required for next Level: 31

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Re: Graphically check linearity in logit regression

    Quote Originally Posted by noetsi View Post
    Why not run a Box-Tidwel test instead. You don't have to rely on graphical methods for this.

    http://www.ats.ucla.edu/stat/stata/w.../statalog3.htm

    If you suspect non-linearity from this one solution is to create an interaction term of the predictors times the natural log of that predictor. Then use these interaction terms (and the original predictors) to predict the original DV. If any of the terms are found to be signficant it suggests that term may be non-linear in predicting the DV.

    Hi,

    I am using SAS for my logistic regression analysis and don't seem to know the code for the boxtid test. I already did the link test and it shows that I have a specification error in my model, but I also do not know which RHS variable has the issue or which variables i should interact. Any help?

    Thanks,

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

    Re: Graphically check linearity in logit regression

    What is the link test in SAS and what do you mean by RHS.
    Stop cowardice, ban guns!

  5. #20
    Points: 19, Level: 1
    Level completed: 37%, Points required for next Level: 31

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Graphically check linearity in logit regression

    Quote Originally Posted by hlsmith View Post
    What is the link test in SAS and what do you mean by RHS.
    RHS- Right Hand Side

    Link test checks for specification errors. So if the link test is significant, it means I need to change the specification like introduce an interaction term.

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

    Re: Graphically check linearity in logit regression

    How are you prompting this "link test" in SAS?
    Stop cowardice, ban guns!

  7. #22
    Points: 132, Level: 2
    Level completed: 64%, Points required for next Level: 18
    Phaedrus's Avatar
    Posts
    15
    Thanks
    3
    Thanked 1 Time in 1 Post

    Re: Graphically check linearity in logit regression

    Quote Originally Posted by hlsmith View Post
    What is the link test in SAS and what do you mean by RHS.
    The basic idea of a linktest is that if your model is properly specified, then, regressing your independent variable on the prediction of the model plus its squared will yield that the latter has no explanatory power

    Quote Originally Posted by m.o View Post
    Hi,

    I am using SAS for my logistic regression analysis and don't seem to know the code for the boxtid test. I already did the link test and it shows that I have a specification error in my model, but I also do not know which RHS variable has the issue or which variables i should interact. Any help?

    Thanks,
    A bit out of context given that, as I understand, this is the subforum for Stata and a thread about graphing linear relationships :P Anyways, the best thing you can do is following the theory on your subject matter.

  8. #23
    Points: 2, Level: 1
    Level completed: 3%, Points required for next Level: 48

    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Graphically check linearity in logit regression

    Hi all, I am performing a random effect logistic regression and I wanted to check for the linearity. I wanted to know whether it is possible to perform box-tidwell test for already log transformed independent variables. I originally log transformed my independent variables as they had a skewed distribution. Thank you all in advance.

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

    Re: Graphically check linearity in logit regression

    Ritu,


    I am reporting this post, to have it created as a new thread. Good question though.
    Stop cowardice, ban guns!

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

    Re: Graphically check linearity in logit regression


    Well, I took some time to investigate this topic last night, and I found it to be very interesting.


    A proposed method to graphically check the linear relationship between the expected values (log odds, AKA logit) and a continuous independent covariate is the following:

    -Plot a loess model to get smoothed probabilities for the binary outcome controlling for the continuous predictor. So instead of a logistic model use a loess model.


    -Convert outputted smoothed probabilities into log odds (i.e., log[p/(1-p)]).


    -Now plot log odds on the y-axis against the raw values of the continuous independent variable on the x-axis.


    -Examine the linear relationship, you can play around with the smoother used in the loess model in the earlier step to clean up the shape of the plotted line.


    -If no breach in linearity assumption, then run normal logistic model with original terms.


    Side notes, the smoothed log odds can be a little wobbly at the extreme values of the continuous independent variable used in the plot. This can be due to data sparsity. You can slightly disregard this wobbliness, just remember it if you make generalizations (this kind of reminded me of very low or high propensity scores). If there is not a linear relationship seen in the plot, consider including a spline term in logistic regression or using a general additive model. Another option is trying to transform the continuous variable and refitting the relationship and plot.


    Also, if the line has a distinct change or if there is a suspected interaction, then this process can be used to examine for a continuous IV and categorical IV interaction. I believe you could just split your dataset into subgroups of the categorical variable and run multiple loess models for the unique categorical variables and compare the generated lines using plots. If there is an interaction, you can potentially add it to the logistic model along with the continuous or spline version of the continuous variable (if appropriate), but remember to include the main effect terms for the interaction term in the model as well, like in traditional logistic regression. A final option may be comparing the -2logL for the candidate models - if they are nested.


    noetsi, I found some SAS code to do this at the following link:


    http://statistics.ats.ucla.edu/stat/sas/examples/alr2/hlch4sas.htm
    Stop cowardice, ban guns!

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

    noetsi (04-19-2016)

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2

           




Tags for this Thread

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