Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple Slope analysis for two-way interaction between dummy and continous variables in logistic regression

    Hello everybody,

    I would greatly appreciate your input on a problem that is bothering me for some time now.

    I have a logistic model with a binary dependent variable of the following nature: y = b1 + b2A + b3M + b4M*A

    Where b1 is the intercept, M is a variable continous between 0 and 1, I would like to use as a moderator, and A is a dummy variable.

    B4 shows to be significant in my regression. And when I plot the results using the logistic template from Jermey Dawson I get an interesting picture. However, to be able to include what I „see“ in the graph I am required to do a simple slope analysis for the cases
    1. M=1
    2. M=0
    to find out if these are significant and this is where I struggle.

    I have tried to look for help in Aiken and West (1991) and Dawson (2014), which tells me that I cannot use simple slope templates as they only work for linear models. (This is what I did before)

    Looking at the problem it does not seem that complicated, however, I cannot solve it. Has any of you experience with simple slopes? Maybe even in the context of logistic regressions with an interaction between a continous and a dummy variable?

    Maybe you can refer me to an example.

    Also if there is anyway I can do this work in stata, this would be great. I am not sure if there is an application within stata to calculate the significance of the slopes.

    Thanks for reading! I appreciate your comments and help.

    Best,
    Keith

  • #2
    Keith:
    assuming that you code is:

    Code:
    y=b1+b2A+b3M+b4M*A
    you may want to try:

    Code:
    logit y c.M##i.A, allbaselevels
    This way you will obtain both the so-called main effect of A and M (which are indeed conditional on the following interaction) as well as the interaction itself (quoting -estimation options- helpfile, the -allbaselevels- option will
    display all base levels for factor variables and interactions
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you Carlo for your quick response.

      You are right, my model is y=b1+ b2A +b3M+ b4M*A

      Maybe I should add that I am working with panel data.

      I performed the regression using allbaselevels. However, this shows no additional information as the interactions effects were already shown using the code before. I guess your advice was lead by me not explaining precisely where my problem is. I will give it a second try with some visiual help:

      Please consider the pictures I have added. The first picture shows the template of Jeremy Dawson for a two-way logisitic regression. Now, what I am interested in is to test, if the two slopes are indeed significant so that I can interpret what I see as significant effects (apart from the simple interaction coefficent that shows up in the regression).

      [The second picture is far less relevant as it is not the correct template for a logistic regression. However, it includes the posibility of testing the gradient for linear models, which is what I want to perform for my logistic regression. Again, please dont get distracted by this or the graph which has nothing to do with my problem. I inclueded it only to be more precise about the problem I am trying to solve.]

      Comment


      • #4
        Keith:
        thanks for providing more details.
        ​If you're working with panel data, you should consider -xtlogit- and -xtlogit postestimation- entries in Stata .pdf manual.
        Closing-out aside: please consider that it is far better to post what you typed and what Stata gave you back (as per FAQ) than pictures, which are often difficult to read and always impossible to amend whenever a wrong code or equations are reported. Thanks.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          After you have followed Carlo's good advice, the simplest way to get the values of the "slopes" (by which I assume you mean marginal effects on outcome probability), is:

          Code:
          margins, dydx(A) at(M=(0 1))

          Comment


          • #6
            Thank you Carlo and Clyde for your help on this!

            Comment

            Working...
            X