Announcement

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

  • Kind request for help interpreting categorical##categorical OLS interaction

    Dear Statalist,

    I have found the following example and interpretation of a categorical by categorical linear interaction but have trouble following the gender#prog explanation. Here is the source: https://stats.oarc.ucla.edu/stata/se...actions-stata/ (towards the end of the page, heading categorical by categorical).

    Previously, I thought one interprets the interactions as follows: 1 and 0; 0 and 1; 1 and 1 (compared to 0 and 0).

    In the example below, the reference gender is female, and the reference for prog is reading.

    To begin:
    male | -.3354569 in my opinion is when male = 1 and prog = 0 (so reading)

    Under prog:
    jog: when jog = 1 and male = 0 (so female) vs. female and reading
    swim: when swim = 1 and male = 0 (so female) vs. female and reading

    gender#prog:
    male#jog when male = 1 and jog = 1 vs. Male = 0 (so female) and jog=0 (so reading)
    male#swim when male = 1 and swim = 1 vs. Male = 0 (so female) and swim=0 (so reading)


    Code:
    -------------------------------------------------------------------------------------
                        |               Robust
      loss | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    --------------------+----------------------------------------------------------------
    gender |
     male  |  -.3354569   .7527049    -0.45   0.656    -1.812731    1.141818
          |
    prog  |
    jog |   7.908831   .7527049    10.51   0.000     6.431556    9.386106
    swim |   32.73784   .7527049    43.49   0.000     31.26057    34.21512
           
    gender#prog |
    male#jog  |   7.818803   1.064486     7.35   0.000     5.729621    9.907985
    male#swim  |  -6.259851   1.064486    -5.88   0.000    -8.349033   -4.170669
    As per the page:
    • male: the simple effect of males for Djog=0,Dswim=0 (i.e., the male – female weight loss in the readinggroup).
    • b^2 jog: the simple effect of jogging when Dmale=0 (i.e., the difference in weight loss between jogging versus reading for females).
    • b^3 swim: the simple effect of swimming when Dmale=0 (i.e., the difference in weight loss between swimming versus reading for females).
    • b^4 male#jog: the interaction of Dmale and Djog, the male effect (male – female) in the jogging condition versus the male effect in the reading condition. Also, the jogging effect (jogging – reading) for males versus the jogging effect for females.
    • b^5 male#swim: the interaction of Dmale and Dswim, the male effect (male – female) in the swimming condition versus the male effect in the reading condition. Also, the swimming effect (swimming- reading) for males versus the swimming effect for females.
    Based on these explanations, I have two questions. I appreciate every comment and help!

    Q1: male | -.3354569 is the additional weight loss over women by reading? I.e., men gain more (because of a negative loss) by reading than women?

    Q2: Are my interpretation of prog and prog##gender correct?

    I have trouble understanding the additional sentence in gender#prog: Also, the jogging effect (jogging – reading) for males versus the jogging effect for females. (and for swimming).

    Does this mean both sentences happen simultaneously?


    Thank you so much in advance!

  • #2
    Previously, I thought one interprets the interactions as follows: 1 and 0; 0 and 1; 1 and 1 (compared to 0 and 0).
    That's correct when both interacted variables are dichotomous. But in this example, the prog variable has 3 levels, so there is more output, reflecting that.

    Q1: male | -.3354569 is the additional weight loss over women by reading? I.e., men gain more (because of a negative loss) by reading than women?
    Yes to the first question, no to the second. The second is wrong because it could also be the case that men simply lose less without actually gaining. They don't necessarily have a negative weight loss, it's just that their weight loss is less than that of the women. (You could figure out whether the men gain or just lose less if the constant were shown. Or, better still, by using -margins-.)

    Q2: Are my interpretation of prog and prog##gender correct?
    Yes, they are.

    Just one suggestion for improvement: I don't like the term "simple slope." Although you are using it correctly here, in my experience, people often confuse it for some vague notion of "overall slope" that is independent of the other variable in the interaction--which is completely wrong. To be clear, I prefer to say "slope conditional on insert name of other variable = insert reference category of other variable." Yes, it's a bit of a mouthful, but the second or so it takes to say that can prevent hours of confusion. (And interaction models are confusing enough even when you're not looking for trouble.)

    I have trouble understanding the additional sentence in gender#prog: Also, the jogging effect (jogging – reading) for males versus the jogging effect for females. (and for swimming).

    Does this mean both sentences happen simultaneously?
    Yes, they happen simultaneously. In fact, they are mathematically equal.

    Comment


    • #3
      Thank you, Clyde! As always, you are so helpful! I greatly appreciate your time and your effort!

      Comment


      • #4
        Hello,

        I have a very similar question to this and would appreciate your help: I have three distinct groups, groups 1,2,3 (R,S, A), and currently interact it with treatment_control (binary). So the reference groups are A in agent, and the control group is 3 years.

        Are my interpretations correct?

        The first line agent seems easy: The coefficient of R over A when both are in T_C == 0 (i.e., after 3 years). So group R is 12 percentage points less likely to perform an action compared to group A when both are in the 3 year group.
        Likewise, S over A when both are in the 3 year group.: Compared to group A, group S is 19 percentage points less likely to be active when analyzing their behavior after 3 years.

        Now, T_C 6 years is where I start having problems:
        Following Scott's and Clyde's logic, it is 6 years when the agent = 0. Agent =0 means not A; so does it mean Groups S and R (like together?) after 6 years compared to Group A after 6 years?

        How do I interpret the .0186979 coefficient?

        Then lastly, R#6, I think, means R and 6 years over the reference group and 3 years.
        So group R after 6 years is 3.7 percentage points more likely to be active compared to Group A after 3 years.
        Likewise with S after 6 years: they are 2.1 percentage points less likely to perform an action compared to group A after 3 years.

        I understand that I have no significance in T_C and agent##T_C but would, nonetheless, like to report the results: Can I say the following: I find no statistical significance in the behavior of Groups R and S after 6 years compared to group A after 3 years.

        Code:
        Linear regression                               Number of obs     =      2,701
                                                        F(20, 780)        =       5.65
                                                        Prob > F          =     0.0000
                                                        R-squared         =     0.0607
                                                        Root MSE          =     .46932
        
                                                      (Std. err. adjusted for 781 clusters in ID)
        -------------------------------------------------------------------------------------------
                                  |               Robust
                            action | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        --------------------------+----------------------------------------------------------------
                            agent |
                               R  |  -.1243827     .04825    -2.58   0.010    -.2190979   -.0296675
                               S  |  -.1946706   .0652599    -2.98   0.003    -.3227765   -.0665647
                                  |
                              T_C |
                         6 years  |   .0186979   .0525874     0.36   0.722    -.0845318    .1219276
                                  |
                        agent#T_C |
                        R#6 years |  .0378773   .0628656     0.60   0.547    -.0855286    .1612832
                        S#6 years |  -.0212749   .0831652    -0.26   0.798     -.184529    .1419791
        Thank you so much!
        Last edited by Matthew Berg; 09 Feb 2024, 06:17. Reason: Provided more explanations

        Comment


        • #5
          This is an excerpt of the regression, and I can provide the full regression if needed.
          Last edited by Matthew Berg; 09 Feb 2024, 07:46.

          Comment


          • #6
            Hi Matthew,
            Here is my opinion on the interpretation of your case. Nonetheless, I hope Clyde will provide the correct explanation.

            I'm not sure if I agree with your statement that agent = 0 means not A. If I understand you correctly, group A is the reference group, and 3 years is the reference group for T_C. I argue that agent = 0 is the base that is currently missing. So the 19 percentage points is the effect of group A after 6 years compared to group A after 3 years. Hence, after 6 years (vs. 3 years) group A is 19 percentage points more likely to be active.

            Logically, this would make sense (to me) (and maybe only to me lol) as

            agent R and S measure the behavior after 3 years compared to base of agent A also after 3 years (respectively, not together).

            T_C 6 years now measures only the effect of the passage of time on the base: i.e., agent A is 19 pp more likely to be active after 6 years compared to agent A after 3 years.

            agent ## T_C

            R and 6 years versus A and 3 years

            S and 6 years versus A and 3 years.

            Please bear in mind that this is what I learned from Clyde yesterday and would, therefore, highly appreciate his opinion on my interpretation. I apologize if I confused you and, of course, if I am wrong.

            Originally posted by Matthew Berg View Post

            Now, T_C 6 years is where I start having problems:

            Following Scott's and Clyde's logic, it is 6 years when the agent = 0. Agent =0 means not A; so does it mean Groups S and R (like together?) after 6 years compared to Group A after 6 years?

            How do I interpret the .0186979 coefficient?

            Comment


            • #7
              Matthew:
              Stata allows you to find yourself all the answers to your question via -predict-, -mat list e(b)-, -test-, and -lincom-, as in the following toy example:
              Code:
              . use "C:\Program Files\Stata18\ado\base\a\auto.dta"
              (1978 automobile data)
              
              . regress price i.rep78##i.foreign if rep78>=3
              
                    Source |       SS           df       MS      Number of obs   =        59
              -------------+----------------------------------   F(5, 53)        =      0.44
                     Model |  19070228.2         5  3814045.63   Prob > F        =    0.8204
                  Residual |   462156727        53  8719938.25   R-squared       =    0.0396
              -------------+----------------------------------   Adj R-squared   =   -0.0510
                     Total |   481226956        58  8297016.48   Root MSE        =      2953
              
              -------------------------------------------------------------------------------
                      price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
              --------------+----------------------------------------------------------------
                      rep78 |
                         4  |  -725.5185   1136.593    -0.64   0.526    -3005.235    1554.198
                         5  |  -2402.574   2164.008    -1.11   0.272    -6743.024    1937.876
                            |
                    foreign |
                   Foreign  |  -1778.407   1797.111    -0.99   0.327    -5382.955     1826.14
                            |
              rep78#foreign |
                 4#Foreign  |   2158.296   2273.185     0.95   0.347    -2401.136    6717.728
                 5#Foreign  |   3866.574   2925.484     1.32   0.192    -2001.204    9734.352
                            |
                      _cons |   6607.074   568.2963    11.63   0.000     5467.216    7746.932
              -------------------------------------------------------------------------------
              
              . predict fitted, xb
              (5 missing values generated)
              
              . list fitted rep78 foreign if rep78==4 & foreign==0
              
                   +-----------------------------+
                   |   fitted   rep78    foreign |
                   |-----------------------------|
                5. | 5881.556       4   Domestic |
               15. | 5881.556       4   Domestic |
               24. | 5881.556       4   Domestic |
               29. | 5881.556       4   Domestic |
               30. | 5881.556       4   Domestic |
                   |-----------------------------|
               33. | 5881.556       4   Domestic |
               35. | 5881.556       4   Domestic |
               38. | 5881.556       4   Domestic |
               47. | 5881.556       4   Domestic |
                   +-----------------------------+
              
              . di 6607.074 -725.5185
              5881.5555
              
              . list fitted rep78 foreign if rep78==4 & foreign==1
              
                   +----------------------------+
                   |   fitted   rep78   foreign |
                   |----------------------------|
               55. | 6261.444       4   Foreign |
               56. | 6261.444       4   Foreign |
               58. | 6261.444       4   Foreign |
               59. | 6261.444       4   Foreign |
               62. | 6261.444       4   Foreign |
                   |----------------------------|
               63. | 6261.444       4   Foreign |
               70. | 6261.444       4   Foreign |
               72. | 6261.444       4   Foreign |
               73. | 6261.444       4   Foreign |
                   +----------------------------+
              
              . di 6607.074 -1778.407+2158.296-725.5185
              6261.4445
              
              . list fitted rep78 foreign if rep78==3 & foreign==1
              
                   +----------------------------+
                   |   fitted   rep78   foreign |
                   |----------------------------|
               54. | 4828.667       3   Foreign |
               60. | 4828.667       3   Foreign |
               65. | 4828.667       3   Foreign |
                   +----------------------------+
              
              . di 6607.074 -1778.407
              4828.667
              
              . mat list e(b)
              
              e(b)[1,12]
                          3b.          4.          5.         0b.          1.   3b.rep78#   3b.rep78#   4o.rep78#    4.rep78#   5o.rep78#    5.rep78#            
                       rep78       rep78       rep78     foreign     foreign  0b.foreign  1o.foreign  0b.foreign   1.foreign  0b.foreign   1.foreign       _cons
              y1           0  -725.51852  -2402.5741           0  -1778.4074           0           0           0   2158.2963           0   3866.5741   6607.0741
              
              . test 4.rep78#1.foreign=5.rep78#1.foreign
              
               ( 1)  4.rep78#1.foreign - 5.rep78#1.foreign = 0
              
                     F(  1,    53) =    0.40
                          Prob > F =    0.5290
              
              . test 4.rep78#1.foreign+5.rep78#1.foreign=0
              
               ( 1)  4.rep78#1.foreign + 5.rep78#1.foreign = 0
              
                     F(  1,    53) =    1.80
                          Prob > F =    0.1856
              
              . lincom 4.rep78-3b.rep78
              
               ( 1)  - 3b.rep78 + 4.rep78 = 0
              
              ------------------------------------------------------------------------------
                     price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
              -------------+----------------------------------------------------------------
                       (1) |  -725.5185   1136.593    -0.64   0.526    -3005.235    1554.198
              ------------------------------------------------------------------------------
              
              . lincom 4.rep78#1.foreign-4.rep78
              
               ( 1)  - 4.rep78 + 4.rep78#1.foreign = 0
              
              ------------------------------------------------------------------------------
                     price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
              -------------+----------------------------------------------------------------
                       (1) |   2883.815   3007.141     0.96   0.342    -3147.747    8915.376
              ------------------------------------------------------------------------------
              
              .
              As per FAQ, sharing your -regress- code would help interested listers enormously. Thanks.
              Last edited by Carlo Lazzaro; 09 Feb 2024, 08:24.
              Kind regards,
              Carlo
              (StataNow 18.5)

              Comment


              • #8
                Hi Carlo,

                Thank you! I'm sorry, I'm confused. Is the quoted interpretation below incorrect?

                Originally posted by Scott Forrester View Post

                I'm not sure if I agree with your statement that agent = 0 means not A. If I understand you correctly, group A is the reference group, and 3 years is the reference group for T_C. I argue that agent = 0 is the base that is currently missing. So the 19 percentage points is the effect of group A after 6 years compared to group A after 3 years. Hence, after 6 years (vs. 3 years) group A is 19 percentage points more likely to be active.

                Logically, this would make sense (to me) (and maybe only to me lol) as

                agent R and S measure the behavior after 3 years compared to base of agent A also after 3 years (respectively, not together).

                T_C 6 years now measures only the effect of the passage of time on the base: i.e., agent A is 19 pp more likely to be active after 6 years compared to agent A after 3 years.

                agent ## T_C

                R and 6 years versus A and 3 years

                S and 6 years versus A and 3 years.

                Comment


                • #9
                  Scott:
                  I would say that:
                  1) -agent- coefficients expres the difference between A (the reference category), R and S (separately) after 3 years;
                  2) -T_C- holds for all the agents, as it expresses the effect on the dependent variable switching fro 3 to 6 years;
                  3) the remaining coefficients result from the interaction.
                  Kind regards,
                  Carlo
                  (StataNow 18.5)

                  Comment


                  • #10
                    Carlo, Thank you!

                    Regarding 2) Can you please explain this as in 1) the base agent is being actively compared to? Why is no such comparison being made in 2)? Shouldn't 2 be interpreted as the time frame from 6 to 3 only for the base?

                    Comment


                    • #11
                      Scott:
                      no, as you can see from the following toy-example (let's pretend that -foreign-=-T_C-):
                      Code:
                      . use "C:\Program Files\Stata18\ado\base\a\auto.dta"
                      (1978 automobile data)
                      
                      . regress price i.rep78##i.foreign if rep78>=3
                      
                            Source |       SS           df       MS      Number of obs   =        59
                      -------------+----------------------------------   F(5, 53)        =      0.44
                             Model |  19070228.2         5  3814045.63   Prob > F        =    0.8204
                          Residual |   462156727        53  8719938.25   R-squared       =    0.0396
                      -------------+----------------------------------   Adj R-squared   =   -0.0510
                             Total |   481226956        58  8297016.48   Root MSE        =      2953
                      
                      -------------------------------------------------------------------------------
                              price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                      --------------+----------------------------------------------------------------
                              rep78 |
                                 4  |  -725.5185   1136.593    -0.64   0.526    -3005.235    1554.198
                                 5  |  -2402.574   2164.008    -1.11   0.272    -6743.024    1937.876
                                    |
                            foreign |
                           Foreign  |  -1778.407   1797.111    -0.99   0.327    -5382.955     1826.14
                                    |
                      rep78#foreign |
                         4#Foreign  |   2158.296   2273.185     0.95   0.347    -2401.136    6717.728
                         5#Foreign  |   3866.574   2925.484     1.32   0.192    -2001.204    9734.352
                                    |
                              _cons |   6607.074   568.2963    11.63   0.000     5467.216    7746.932
                      -------------------------------------------------------------------------------
                      
                      
                      . mat list e(b)
                      
                      e(b)[1,12]
                                  3b.          4.          5.         0b.          1.   3b.rep78#   3b.rep78#   4o.rep78#    4.rep78#   5o.rep78#    5.rep78#            
                               rep78       rep78       rep78     foreign     foreign  0b.foreign  1o.foreign  0b.foreign   1.foreign  0b.foreign   1.foreign       _cons
                      y1           0  -725.51852  -2402.5741           0  -1778.4074           0           0           0   2158.2963           0   3866.5741   6607.0741
                      
                      
                      
                      . lincom _cons+ 3b.rep78 + 0b.foreign-(_cons+ 3b.rep78 + 1.foreign)
                      
                       ( 1)  0b.foreign - 1.foreign = 0
                      
                      ------------------------------------------------------------------------------
                             price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                      -------------+----------------------------------------------------------------
                               (1) |   1778.407   1797.111     0.99   0.327     -1826.14    5382.955
                      ------------------------------------------------------------------------------
                      
                      . lincom _cons+ 4.rep78 + 0b.foreign-(_cons+ 4.rep78 + 1.foreign)
                      
                       ( 1)  0b.foreign - 1.foreign = 0
                      
                      ------------------------------------------------------------------------------
                             price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                      -------------+----------------------------------------------------------------
                               (1) |   1778.407   1797.111     0.99   0.327     -1826.14    5382.955
                      ------------------------------------------------------------------------------
                      
                      . lincom _cons+ 5.rep78 + 0b.foreign-(_cons+ 5.rep78 + 1.foreign)
                      
                       ( 1)  0b.foreign - 1.foreign = 0
                      
                      ------------------------------------------------------------------------------
                             price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                      -------------+----------------------------------------------------------------
                               (1) |   1778.407   1797.111     0.99   0.327     -1826.14    5382.955
                      ------------------------------------------------------------------------------
                      
                      .
                      Kind regards,
                      Carlo
                      (StataNow 18.5)

                      Comment


                      • #12
                        Clyde Schechter can you please comment on this? I would be most grateful!

                        Dear Carlo and Scott,

                        Thank you very much for your help!

                        To assess my understanding, are the following correct?

                        agent:

                        The coefficient of R over A when both are in T_C == 0 (i.e., after 3 years). So group R is 12 percentage points less likely to perform an action compared to group A when both are in the 3 year group.
                        Likewise, S over A when both are in the 3 year group.: Compared to group A, group S is 19 percentage points less likely to be active when analyzing their behavior after 3 years.

                        T_C:
                        6 years: Is the overall effect of 6 years versus 3 years in all agents; i.e., agents are 19 percentage points more likely to be active after 6 compared to 3 years.

                        agent##T_C:

                        the respective agent in 6 years vs the base of A after 3 years?

                        So,

                        R and 6 years versus A and 3 years

                        S and 6 years versus A and 3 years.


                        Comment


                        • #13
                          I'm so sorry to dwell on this, but now I have a question regarding the T_C in my regression without any interactions: According to my understanding of Carlo's response in #9 regarding the T_C 6 year coefficient from my interaction in #4:

                          T_C 6 year is 19 percentage points and is the increase in action from all agents from 3 to 6 years. Please, is this correct? So it goes from "not on" to "on" for all?


                          Provided my understanding is correct, why do the coefficients of T_C not match / are slightly similar? Per my OLS regression, the treatment condition of 6 years vs 3 years has no effect on the action.


                          Code:
                           
                          Linear regression                               Number of obs     =      2,701
                                                                          F(18, 780)        =       6.22
                                                                          Prob > F          =     0.0000
                                                                          R-squared         =     0.0602
                                                                          Root MSE          =     .46928
                          
                                                                (Std. err. adjusted for 781 clusters in ID)
                          -----------------------------------------------------------------------------------
                                            |               Robust
                                   action   |     Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                          ------------------+----------------------------------------------------------------
                                      agent |
                                         R  |  -.1062534   .0380569    -2.79   0.005    -.1809594   -.0315473
                                         S  |  -.2074968   .0454508    -4.57   0.000    -.2967171   -.1182764
                                            |
                                        T_C |
                                   6 years  |   .0386985   .0269817     1.43   0.152    -.0142667    .0916638
                                            |
                                confidence  |
                                         2  |   .0230749   .0183546     1.26   0.209    -.0129554    .0591052
                                         3  |   .0038009   .0204002     0.19   0.852     -.036245    .0438467
                                         4  |  -.0320343    .020582    -1.56   0.120     -.072437    .0083684
                                            |
                                      round |
                                         2  |   .0074241   .0202163     0.37   0.714    -.0322607     .047109
                                         3  |   .0383144   .0210446     1.82   0.069    -.0029963    .0796251
                                         4  |   .0186783   .0206997     0.90   0.367    -.0219553     .059312
                                            |
                                   1.reby_n |   .1123283   .0291455     3.85   0.000     .0551153    .1695413
                                            |
                                     gender |
                                    female  |  -.1036541   .0360208    -2.88   0.004    -.1743633   -.0329449
                                non-binary  |   -.226735   .1180531    -1.92   0.055    -.4584745    .0050045
                                not stated  |   .0943532    .117369     0.80   0.422    -.1360433    .3247497
                                            |
                                     device |
                                    Tablet  |   .0425062   .1147222     0.37   0.711    -.1826947    .2677071
                                Smartphone  |   .0193328   .0402464     0.48   0.631    -.0596713    .0983368
                                            |
                                     system |
                                   Android  |   .0235394   .0458296     0.51   0.608    -.0664246    .1135033
                                     Apple  |   .0075322   .1349259     0.06   0.955    -.2573286     .272393
                                            |
                              1.instruclick |   .0766133    .029392     2.61   0.009     .0189166      .13431
                                      _cons |   .3397302    .044488     7.64   0.000     .2523999    .4270605
                          -----------------------------------------------------------------------------------

                          THANK YOU IN ADVANCE!

                          Comment


                          • #14
                            The coefficient of R over A when both are in T_C == 0 (i.e., after 3 years). So group R is 12 percentage points less likely to perform an action compared to group A when both are in the 3 year group.
                            Likewise, S over A when both are in the 3 year group.: Compared to group A, group S is 19 percentage points less likely to be active when analyzing their behavior after 3 years.
                            Correct.

                            T_C:
                            6 years: Is the overall effect of 6 years versus 3 years in all agents; i.e., agents are 19 percentage points more likely to be active after 6 compared to 3 years.
                            No. This coefficient says that those with agent == "A" are 19 percentage points more 1.9 percentage points (not 19) more likely to be active after 6 years than after 3 years. In an interaction model, there is no such thing as the "overall effect" of any interacted variable. There are only effects conditional on the values of the other interacted variables.

                            As for the coefficients of agent#T_C:
                            R#6 years is the difference in probability of action for a person with agent = R after 6 years and a person with agent = R after 3 years. It is also the difference in probabilitiy of action for a person with agent = R after 6 years and a person with agent = S after 6 years. (Yes, those are different concepts, but the amount is the same.)

                            I think that the interpretation of these coefficients is difficult: only after you have done this sort of thing many times will it come naturally to you. I think a better approach is to use the -margins- command.
                            Code:
                            margins agent#T_C
                            will give you a table with 6 rows of output, one for each of the combinations of 6 years vs 3 years with A, R, S. The numbers it outputs will be the expected probability of action in each of those 6 situations.

                            To look at the conditional effects of agent and of T_C you can run
                            Code:
                            margins T_C, dydx(agent)
                            margins agent, dydx(T_C)
                            And if you would like to see the differences in probability of outcome among all combinations of agent and T_C you can run
                            Code:
                            margins agent#T_C, pwcompare
                            Last edited by Clyde Schechter; 09 Feb 2024, 11:11.

                            Comment


                            • #15
                              Thank you so much for clearing my confusion regarding T_C 6 years.

                              I have re-run the regression and after that the -margins command:

                              Code:
                              
                              . margins agent, dydx(T_C)
                              
                              Average marginal effects                                 Number of obs = 2,701
                              Model VCE: Robust
                              
                              Expression: Linear prediction, predict()
                              dy/dx wrt:  1.T_C
                              
                              -----------------------------------------------------------------------------------
                                                |            Delta-method
                                                |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
                              ------------------+----------------------------------------------------------------
                              0.T_C             |  (base outcome)
                              ------------------+----------------------------------------------------------------
                              1.T_C             |
                                          agent |
                                             R  |   .0565752   .0345697     1.64   0.102    -.0112855    .1244359
                                             A  |   .0186979   .0525874     0.36   0.722    -.0845318    .1219276
                                             S  |  -.0025771   .0647519    -0.04   0.968    -.1296857    .1245316
                              -----------------------------------------------------------------------------------
                              Note: dy/dx for factor levels is the discrete change from the base level.
                              Here, I recognize the A group coefficient from T_C 6 years, in that people from group A after 6 years are 1.9 percentage points more likely to be active than people from group A after 3 years.


                              I'm so sorry that I have another question related to the interpretation of agent##T_C: R## 6 years: coefficient of .038 --> This means that group R after 6 years is 3.8pp more likely to perform an action compared to R after 3 years. Is this correct?


                              Q: If so, Why does this table not reflect the same coefficients of 0.037 for R and -.021 for S. (taken from agent##T_C) - but instead has different coefficients? I see how the margins table shows each group after 6 years compared to 3 years. So why are these coefficients not included? Where can I find the coefficients 0.037 for R and -.021 for S in a table?


                              THANK YOU SO VERY MUCH! I do apologize for my questions. May I just add that your explanations are very clear and highly appreciated by me!


                              Comment

                              Working...
                              X