Announcement

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

  • margins with two types of interactions

    I'm running the following two logistics models, with the only difference being how time is treated (categorical vs. continuous). They are simple modes where time interacts with female.

    Model 1, where time is included as indicators:
    Code:
    logit event2 (i.female)##i.enrl_sequence_gap, r
    margins female#enrl_sequence_gap
    marginsplot, xdimension(enrl_sequence_gap) plotdimension(female) noci

    Model 2, where time is included as a continuous variable:
    Code:
    logit event2 (i.female)##c.enrl_sequence_gap, r
    margins female, at(enrl_sequence=(1(1)24)) 
    marginsplot, xdimension(enrl_sequence_gap) plotdimension(female) noci
    Here are the results plotted:

    model 1 marginsplot:
    Click image for larger version

Name:	Screenshot 2024-04-30 131854.png
Views:	1
Size:	98.1 KB
ID:	1751818


    model 2 marginsplot:
    Click image for larger version

Name:	Screenshot 2024-04-30 132148.png
Views:	1
Size:	76.5 KB
ID:	1751819


    I have three (related) questions:

    1. I don't understand why the two plots look so different - does model 1 show instantaneous probability, but model 2 shows cumulative probability? Why is the second marginsplot smoothed like that?
    2. How should "time" be treated (indicator vs continuous)? Are there underlying assumptions to go with each?
    3. I'm trying to estimate the predicted probability by gender. Are my margins commands correct? For example, should I add options such as atmeans or noesample?

    Thank you!

  • #2
    Andrew Musau

    Clyde Schechter

    when you have a moment, would you be able to take a look at this? (Sorry, for tagging you, but your comments in the past were tremendously helpful!)

    Comment


    • #3
      I don’t know if it makes sense substantively but there is no reason the graphs can’t look like that. If you treat time as continuous the effects have to be linear. If you treat it as categorical the effects are free to follow any pattern — up, down, up, up ,up, down… you could randomly rearrange the cateregories of time and you’d get the same fit and the same graph points but in different order.

      Just eyeballing your first graph I would consider adding a time-squared term, as it looks like the relation may be curvilinear, i.e. U shaped. Curvilinear reletationships certainly aren’t unusual. For example I was faster at age 20 than I was at age 1, but at age 68 I am a lot slower than I was at age 20!
      -------------------------------------------
      Richard Williams
      Professor Emeritus of Sociology
      University of Notre Dame
      StataNow Version: 19.5 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://academicweb.nd.edu/~rwilliam/

      Comment


      • #4
        Also you don’t say anything about you sample size or show confidence intervals, but if the Ns are pretty small for some times you could see a lot of fluctuation from one point to the next simply because of sampling variability.
        -------------------------------------------
        Richard Williams
        Professor Emeritus of Sociology
        University of Notre Dame
        StataNow Version: 19.5 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://academicweb.nd.edu/~rwilliam/

        Comment


        • #5
          Thank you, Richard! This is very helpful! (BTW the margins documents you put together are my to-go guide)

          I have two follow-up questions:
          1. is there a way to force monotonicity for time when it's categorical?
          2. is the predicted probability (y axis) instantaneous probability or cumulative probability?

          Comment

          Working...
          X