Announcement

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

  • Calculating predicted values from lagged variables in a logistic regression model

    Hello all,

    I am using Stata 14 on a Mac. I have a panel data set, in which individuals are followed for 16 rounds. I am looking at the relationship between being arrested and employment outcomes.

    Specifically, I would like to estimate the predicted probability of employment for (a) two periods prior to arrest, (b) the year of arrest, and (c) five periods after the arrest. Following the guidance on the Stata website, I can estimate the estimated change in probability at each time point, as follows

    Code:
    tsset pubid round
    logit emp_dli f(1/2).arr_first l(0/5).arr_first if fem_good==1 
    margins, dydx(_all)
    This gives me the predicted change in probability between groups, as follows:
    Code:
    Expression   : Pr(emp_dli), predict()
    dy/dx w.r.t. : F.arr_first F2.arr_first arr_first L.arr_first L2.arr_first L3.arr_first L4.arr_first L5.arr_first
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
       arr_first |
             F1. |  -.0313027   .0232338    -1.35   0.178      -.07684    .0142347
             F2. |  -.0399611   .0224618    -1.78   0.075    -.0839855    .0040633
             --. |  -.0121335   .0233709    -0.52   0.604    -.0579396    .0336725
             L1. |  -.0034893   .0228872    -0.15   0.879    -.0483474    .0413689
             L2. |   .0067166   .0226751     0.30   0.767    -.0377258    .0511589
             L3. |  -.0490618   .0199689    -2.46   0.014    -.0882001   -.0099234
             L4. |  -.0202748   .0215074    -0.94   0.346    -.0624285    .0218788
             L5. |  -.0606021   .0192701    -3.14   0.002    -.0983708   -.0228333
    ------------------------------------------------------------------------------

    But I want predicted values for each group and time point. Can anyone tell me how to get this?

    Thanks.




    Amanda

  • #2
    But I want predicted values for each group and time point.
    I don't understand what you mean. I don't see any group variable in your model, and in this context I'm not even sure what you mean by time point. Can you perhaps explain in greater detail, or perhaps show a table shell?

    Comment


    • #3
      Thank you for responding Clyde.

      I would like to estimate the probability of employment for respondents who were arrested and those who were not (these are the groups) for a total of 8 time points (t-2, t-1, t (year of arrest), t+1, t+2, t+3, t+4, and t+5.

      Is this what you mean by a table shell?

      Estimated probability of employmment, by arrest status
      Not arrested Arrested
      t-2
      t-1
      t
      t+1
      t+2
      t+3
      t+4
      t+5
      Amanda

      Comment


      • #4
        Yes, that's what I meant by a table shell. Thank you.

        I get it now. Well, you will first have to rerun the regression using factor variable notation so that Stata will correctly recognize the arr* variables as dichotomous rather than continuous. (And you have to rerun your -margins, dydx()- as well because those results were based on continuous arr* variables and are, therefore, incorrect.)

        Code:
        logit emp_dli i.(f(1/2).arr_first l(0/5).arr_first) if fem_good==1
        margins, dydx(_all)
        margins F2.arr_first F1.arr_first arr_first L1.arr_first L2.arr_first ///
            L3.arr_first L4.arr_first L5.arr_first

        Comment


        • #5
          Thank you for your quick response Clyde. This worked perfectly!

          Comment

          Working...
          X