Announcement

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

  • How to graph and interpret the interaction between 2 continuous variables in poisson model with a countinous dependent variable?

    Hi all,

    I am running a poisson model using poisson looking at the effect of 2 continuous variables and the interaction between these on a continuous outcome variable (such as income,sales).
    My code is as follows:

    poisson depvar c_var1 c_var1(square term) c_var2 c_var2(square term) c_var1_c_var2, vce(robust)

    The interaction effect is significant (β=-.000041, SE=.0000214, p=0.055) so in order to understand what direction the effect is in I want to picture the interaction.

    which code should I use in this case? Also, what does the scale on the y-axis refer to?

    Before posting, I've read the previous posts below, but they are a bit far from the case i am facing
    http://www.statalist.org/forums/foru...ts-panel-model
    http://www.ats.ucla.edu/stat/stata/dae/poissonreg.htm
    http://www.stata.com/statalist/archi.../msg01198.html

    Many thanks for any help,
    David

  • #2
    David:
    -please post what you typed and what Stata gave you back via CODE delimiters (as per FAQ). It 's easy to do (and makes threads easy to read and to reply to): read FAQ #12 on this topic. Thanks.
    . more in general: for interactions and squared terms, it's better to rely on -fvvarlist- capabilities, especially for the valuable relationships that -fvvarlist- has with some important Stata postestimation commands (e.g.: -margins-; -marginsplot-).
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      David:
      -please post what you typed and what Stata gave you back via CODE delimiters (as per FAQ). It 's easy to do (and makes threads easy to read and to reply to): read FAQ #12 on this topic. Thanks.
      . more in general: for interactions and squared terms, it's better to rely on -fvvarlist- capabilities, especially for the valuable relationships that -fvvarlist- has with some important Stata postestimation commands (e.g.: -margins-; -marginsplot-).
      Hi Carlo,

      Thanks for your advice. I've read FAQ#12.

      Code:
      poisson depvar c_var1 c_var1square c_var2 c_var2square c_var1_c_var2, vce(robust)
      Stata gave me the results, no error encounting. What I want to know is how to graph and interpret the interaction between 2 continuous variables in poisson model with a countinous dependent variable? Since they're not catergorial variables, and also the dependent variable is not a count variable typical for poisson regression. So, i am not sure if it is still ok to graph it and interpret it in the same way as that for catergorial variable. Any relevant example on graphing and interpretation of these cases would be helpful.

      Thx in advance,
      David

      Comment


      • #4
        David:
        thanks for the effort, but the same issue apply to what Stata gave you back; otherwise, there's too little to comment upon.
        You can copy the output of your poisson regression and paste it in between CODE delimiters, just like you did for Stata code. Thanks.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Originally posted by Carlo Lazzaro View Post
          David:
          thanks for the effort, but the same issue apply to what Stata gave you back; otherwise, there's too little to comment upon.
          You can copy the output of your poisson regression and paste it in between CODE delimiters, just like you did for Stata code. Thanks.
          Hi Carlo,

          I copy the output of my poisson regression and paste it in between CODE delimiters


          Code:
           
          poisson yus crco cr co sqco lna lnemp lnenv ca i.indcode i.areacode ,vce(robust)
          Iteration 0: log pseudolikelihood = -1.288e+11
          Iteration 1: log pseudolikelihood = -9.349e+10 (backed up)
          Iteration 2: log pseudolikelihood = -3.457e+10 (backed up)
          Iteration 3: log pseudolikelihood = -2.309e+10
          Iteration 4: log pseudolikelihood = -9.985e+09
          Iteration 5: log pseudolikelihood = -7.780e+09
          Iteration 6: log pseudolikelihood = -7.577e+09
          Iteration 7: log pseudolikelihood = -7.564e+09
          Iteration 8: log pseudolikelihood = -7.564e+09
          Iteration 9: log pseudolikelihood = -7.564e+09
          Poisson regression Number of obs = 267
          Wald chi2(33) = .
          Prob > chi2 = .
          Log pseudolikelihood = -7.564e+09 Pseudo R2 = 0.8102
          Robust
          yus Coef. Std. Err. z P>z [95% Conf. Interval]
          crco -.000018 .0000101 -1.79 0.074 -.0000378 1.76e-06
          cr .000033 6.96e-06 4.74 0.000 .0000193 .0000466
          co -2.934839 1.341334 -2.19 0.029 -5.563805 -.3058731
          sqco 2.875029 1.719234 1.67 0.094 -.4946069 6.244665
          lna .6264417 .244957 2.56 0.011 .1463348 1.106549
          lnemp 1.450958 .1173224 12.37 0.000 1.22101 1.680905
          lnenv 4.069176 4.939343 0.82 0.410 -5.611758 13.75011
          ca .8251975 .556747 1.48 0.138 -.2660066 1.916402
          indcode
          14 -.0793765 .5011181 -0.16 0.874 -1.06155 .9027969
          15 -.4016717 .6432274 -0.62 0.532 -1.662374 .8590309
          17 -3.492987 .5866811 -5.95 0.000 -4.642861 -2.343114
          18 -3.177437 .6597376 -4.82 0.000 -4.470499 -1.884375
          19 -2.439427 .5643795 -4.32 0.000 -3.54559 -1.333263
          20 -3.239832 .5690849 -5.69 0.000 -4.355218 -2.124446
          21 -1.262463 .5230638 -2.41 0.016 -2.287649 -.2372772
          22 -2.314654 .5099875 -4.54 0.000 -3.314211 -1.315097
          23 -4.660993 .5027886 -9.27 0.000 -5.646441 -3.675546
          24 -1.454168 .5667438 -2.57 0.010 -2.564965 -.3433706
          25 -1.322538 1.153481 -1.15 0.252 -3.583319 .9382435
          26 -.1996439 .5176629 -0.39 0.700 -1.214245 .8149567
          27 -2.114506 .8622672 -2.45 0.014 -3.804518 -.4244931
          28 -2.323168 .6243446 -3.72 0.000 -3.546861 -1.099475
          29 -1.748035 .6420591 -2.72 0.006 -3.006447 -.4896219
          30 -1.747706 .6440939 -2.71 0.007 -3.010107 -.4853056
          32 -2.474927 .7158799 -3.46 0.001 -3.878026 -1.071829
          33 -1.738281 .708673 -2.45 0.014 -3.127255 -.3493075
          34 -.5889574 .6293833 -0.94 0.349 -1.822526 .6446112
          35 .796434 .5091535 1.56 0.118 -.2014885 1.794356
          36 -2.070739 .6046242 -3.42 0.001 -3.25578 -.8856969
          37 -4.219452 .5485687 -7.69 0.000 -5.294627 -3.144278
          38 -.7643772 .5256057 -1.45 0.146 -1.794546 .2657911
          39 -2.695696 .6022238 -4.48 0.000 -3.876033 -1.515359
          40 -.7558563 .6634599 -1.14 0.255 -2.056214 .5445012
          41 -2.917633 .5558032 -5.25 0.000 -4.006987 -1.828279
          areacode
          2 .7348222 .3819149 1.92 0.054 -.0137172 1.483362
          3 -.1834387 .7052367 -0.26 0.795 -1.565677 1.1988
          4 .7522449 .7714681 0.98 0.330 -.7598047 2.264295
          5 .4795861 .4573231 1.05 0.294 -.4167507 1.375923
          6 1.194868 .5141567 2.32 0.020 .1871399 2.202597
          7 1.792535 .5958973 3.01 0.003 .6245981 2.960473
          _cons .3935997 5.78161 0.07 0.946 -10.93815 11.72535
          .
          Thx,
          David

          Comment


          • #6
            David:
            which are the interacted variables in your code?
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Originally posted by Carlo Lazzaro View Post
              David:
              which are the interacted variables in your code?
              Hi Carlo,

              It's crco, the interacted variables.

              David

              Comment


              • #8
                David:
                the way you create interactions betweem -cr- and -co- leads you astray.
                Please consider re-creating each interaction via -fvvarlist-.
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  Originally posted by Carlo Lazzaro View Post
                  David:
                  the way you create interactions betweem -cr- and -co- leads you astray.
                  Please consider re-creating each interaction via -fvvarlist-.
                  Hi Carlo,
                  I read the manual of stata about -fvvarlist-, and it's for factor variable, is it still proper to generate interaction between two continuous variables via -fvvarlist- ? Also, could you explain more why it improper to create interactions between -cr and -co- ?

                  David
                  Last edited by David Lu; 07 May 2016, 05:43.

                  Comment


                  • #10
                    David:
                    -please see
                    c. unary operator to treat as continuous
                    in -help fvvarlist-;
                    - -fvvarlist- will give you the conditional main effect of the predictors included in the interactions and, even more important, has a preference link with very useful post-restimation commnands, such as -margins- and -marginsplot-.
                    Kind regards,
                    Carlo
                    (Stata 19.0)

                    Comment


                    • #11
                      If you have access to the data sets used for Michael N Mitchell's book Interpretting and Visualizing Regression models using Stata you'll be able to replicate the example below:

                      Code:
                      use gss_ivrm
                      poisson children c.educ##(c.educ c.realrinc) c.realrinc#c.realrinc, vce(robust)
                      margins, at(educ=(0(5)20) realrinc=(259(100000)480144.5))
                      marginsplot
                      So in addition to Carlo Lazzaro's initial suggestion, you can see that it also makes your code more concise and will use less memory (since you won't be creating additional copies of the data already in memory to generate new variables for the interactions).

                      Comment


                      • #12
                        Originally posted by wbuchanan View Post
                        If you have access to the data sets used for Michael N Mitchell's book Interpretting and Visualizing Regression models using Stata you'll be able to replicate the example below:

                        Code:
                        use gss_ivrm
                        poisson children c.educ##(c.educ c.realrinc) c.realrinc#c.realrinc, vce(robust)
                        margins, at(educ=(0(5)20) realrinc=(259(100000)480144.5))
                        marginsplot
                        So in addition to Carlo Lazzaro's initial suggestion, you can see that it also makes your code more concise and will use less memory (since you won't be creating additional copies of the data already in memory to generate new variables for the interactions).
                        Hi wbuchanan,

                        Thx for the great example and clarification. I applied this code to my data and got the graph now. But as can be seen from the graph, it's almost flat for most of the data. Also,since my dependent variable is a continuos variable like income (not the number of events), how to interpret this graph especially, what is the exact meaning of Y axis here? Is there any method I can apply to make the curve here not so plain?

                        Thx in advance,
                        David

                        Code:
                        poisson income iv1 iv2 c.iv1#c.iv2 c.iv2#c.iv2 cv1 cv2 cv3 cv4 i.indcode i.areacode, vce(robust)
                        margins, at(iv1=(0(20000)180000) iv2=(0(0.2)1))
                        marginsplot
                        Click image for larger version

Name:	Graph.png
Views:	1
Size:	27.9 KB
ID:	1339612

                        Comment


                        • #13
                          Originally posted by Carlo Lazzaro View Post
                          David:
                          -please see in -help fvvarlist-;
                          - -fvvarlist- will give you the conditional main effect of the predictors included in the interactions and, even more important, has a preference link with very useful post-restimation commnands, such as -margins- and -marginsplot-.
                          Hi Carlo,

                          Thx for your further explanation.

                          David

                          Comment

                          Working...
                          X