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

Thread: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

  1. #1
    Points: 66, Level: 1
    Level completed: 32%, Points required for next Level: 34

    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    [SPSS] Multivariable logistic regression - how to transform to achieve linearity?




    Hi,

    I am doing a project to identify variables that can predict rehospitalisations. There are a few categorical and continuous variables that I am considering. How do I transform the continuous variables such that the it has a linear relationship with the logit?

    I am more adept at using SPSS but if advice is given for other statistical package, I am still willing to give it a try.

    Thanks for the help.

  2. #2
    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: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    First you should test to see if they are non-linear If you find them to be non-linear then a series of transformations using roots and powers can be used to make the data more linear. Tukey's ladder is the easiest place to start.

    http://onlinestatbook.com/2/transformations/tukey.html

    Whatever software you use the process is the same. You create new variables from the Y (most commonly although sometimes you transform X) applying the right power transformation until your relationship is linear. It is essentially a trial and error process - you start with the less extreme transformation and move to the more extreme ones until the relationship is linear.

    Note that this process won't always work. Some relationships are inherently non-linear. In some cases this can be addressed, but I don't remember the process (which is complex at best).
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  3. #3
    Points: 881, Level: 15
    Level completed: 81%, Points required for next Level: 19

    Location
    Saint Louis, MO
    Posts
    77
    Thanks
    2
    Thanked 13 Times in 13 Posts

    Re: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    I don't understand the question. The logit model (because of the link function) is inherently non-linear to begin with, so why should you check linearity?
    I have three stars next to my name. This means that everything I say is true.

  4. #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: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    The OP comment

    How do I transform the continuous variables such that the it has a linear relationship with the logit?
    The logit model is non-linear between the dichotomous Y and the predictor. It is linear between the logit and the predictor which is why you test for linearity in logistic regression.

    Or so I have always been taught. If not that is a shock to me....
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  5. #5
    RoboStataRaptor
    Points: 11,861, Level: 71
    Level completed: 53%, Points required for next Level: 189
    bukharin's Avatar
    Location
    Sydney, Australia
    Posts
    1,312
    Thanks
    12
    Thanked 326 Times in 315 Posts

    Re: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    No, you're absolutely right noetsi. That's why it's a generalised linear model.

  6. #6
    Points: 881, Level: 15
    Level completed: 81%, Points required for next Level: 19

    Location
    Saint Louis, MO
    Posts
    77
    Thanks
    2
    Thanked 13 Times in 13 Posts

    Re: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    This is interesting as I've never used these ideas in applied research.

    I suppose what you are saying is that you look at a plot of x and y and see if you find a straight line because the relationship should be linear? Is this correct?
    I have three stars next to my name. This means that everything I say is true.

  7. #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: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    Actually I don't use plots to detect non-linearity. I specify an interaction term between the predictor and it square. If this interaction term is significant for a given predictor non-linearity is indicated. In practice this rarely comes up with my (also applied only) analysis because virtually all of my predictors are dummy variables and they are always linear. Only the continuous ones (I almost never have) can be non-linear.

    Correcting it would involve specifying a transformation (of either the X or Y) until the term is not signficant, although you could use the old fashioned method of looking at a graph to see when it becomes linear.
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  8. #8
    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: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    To paraphrase and confirm that I followed:

    In logistic regression, you should check linearity between continous independent variable and the logit.
    You can do this by introducing an interaction term consisting of a term multiplied by its quadratic term ((continous variable * continuous variable) * continuous variable) in the model. If significant you have non-linearity.

    I wanted to veriry the continous(continous^2) and whether you would also incorporate the basic continous variable at the same time in the model.
    Stop cowardice, ban guns!

  9. #9
    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: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    Note that the formal test of this creates an interaction between a continuous variable and its log (so it is log*Continuousvar). This is Box Tidwell. I was told you could use the square of the continuous var instead of the log of it in the interaction term.
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  10. #10
    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: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    T&F??

    Plus you keep the non-transformed variable still in the model?
    Stop cowardice, ban guns!

  11. #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: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    I modified what I said considerably. You probably should look there instead of what I wrote oringally.

    T&F is Tbachnick and Fidel - I thought we had used this code before.

    You run the original variables and their interaction term as a predictor. It is the signficance of the interaction terms that matters, however for the test of linearity. T&F confuse this considerably in their comments on p 474-475 where they seem to be referencing the p value of the continuous variable itself. 443 and the comments I linked in my last post clarifies what you are really supposed to do, look at the interaction term.

    Note also their modification of the alpha value given FW error discussed on 474
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  12. #12
    Points: 66, Level: 1
    Level completed: 32%, Points required for next Level: 34

    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    Thanks for the help! Using your method, I have managed to transform the logit equation such that it is linear. However, I am still unclear of what I should do now to include the changes into my logistic regression data. Could you help me with it?


    Quote Originally Posted by noetsi View Post
    First you should test to see if they are non-linear If you find them to be non-linear then a series of transformations using roots and powers can be used to make the data more linear. Tukey's ladder is the easiest place to start.

    http://onlinestatbook.com/2/transformations/tukey.html

    Whatever software you use the process is the same. You create new variables from the Y (most commonly although sometimes you transform X) applying the right power transformation until your relationship is linear. It is essentially a trial and error process - you start with the less extreme transformation and move to the more extreme ones until the relationship is linear.

    Note that this process won't always work. Some relationships are inherently non-linear. In some cases this can be addressed, but I don't remember the process (which is complex at best).

  13. #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: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    I am not sure I understand the question. If you transformed a variable to make it linear you replace the non-linear variable with the new transformed one and then run the model as you would with any variable. Note that in interpreting the results you need to reference the transformed measurement (like refering to the logged variable rather than the original scale). Alternatively you can transform back to the original variable after running the model (which is highly reccomended by authors, but which I have never done myself so can not provide details of the interpretation that results).
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  14. #14
    Points: 66, Level: 1
    Level completed: 32%, Points required for next Level: 34

    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?

    Thanks for the reply. But in binary logistic regression, I am transforming the logit(Ln(p/(1-p))) isn't it? It is not the y, which is a 1 or 0, that I will use to run in the logistic regression.

    Quote Originally Posted by noetsi View Post
    I am not sure I understand the question. If you transformed a variable to make it linear you replace the non-linear variable with the new transformed one and then run the model as you would with any variable. Note that in interpreting the results you need to reference the transformed measurement (like refering to the logged variable rather than the original scale). Alternatively you can transform back to the original variable after running the model (which is highly reccomended by authors, but which I have never done myself so can not provide details of the interpretation that results).

  15. #15
    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: [SPSS] Multivariable logistic regression - how to transform to achieve linearity?


    All the transformations I have seen have been of the raw data not of a calculated logit. Even with Y you are transforming the 0 and 1 (that is the original data). But there could well be transformations I have not worked with.
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

+ 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