Announcement

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

  • Regression with "L." command

    Hello everyone

    I have a question concerning the number of observations used in Regression models with lagged variables.

    If I run the following regression:

    Code:
    xtpoisson patents cl.ln_xrdintensity##cl.Numberofmergers cl2.ln_xrdintensity##cl2.Numberofmergers cl3.ln_xrdintensity##cl3.Numberofmergers l.ln_emp i.YearEffective i. AcquirorPrimarySICCode, fe vce (robust)


    Code:
    Iteration 0:   log pseudolikelihood = -8509.1651  
    Iteration 1:   log pseudolikelihood = -5237.4019  
    Iteration 2:   log pseudolikelihood =  -5222.134  
    Iteration 3:   log pseudolikelihood = -5222.1333  
    Iteration 4:   log pseudolikelihood = -5222.1333  (backed up)
    
    Conditional fixed-effects Poisson regression         Number of obs    =  1,028
    Group variable: PERMNO                               Number of groups =    158
    
                                                         Obs per group:
                                                                      min =      2
                                                                      avg =    6.5
                                                                      max =      8
    
                                                         Wald chi2(17)    = 782.43
    Log pseudolikelihood = -5222.1333                    Prob > chi2      = 0.0000
    
                                                                (Std. err. adjusted for clustering on PERMNO)
    ---------------------------------------------------------------------------------------------------------
                                            |               Robust
                                    patents | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
    ----------------------------------------+----------------------------------------------------------------
                            ln_xrdintensity |
                                        L1. |   -2.03263   1.065697    -1.91   0.056    -4.121357    .0560969
                                            |
                            Numberofmergers |
                                        L1. |  -.1567646   .0545377    -2.87   0.004    -.2636565   -.0498727
                                            |
      cL.ln_xrdintensity#cL.Numberofmergers |   2.110007   .8692361     2.43   0.015     .4063358    3.813679
                                            |
                            ln_xrdintensity |
                                        L2. |  -.4014874   1.219383    -0.33   0.742    -2.791434    1.988459
                                            |
                            Numberofmergers |
                                        L2. |  -.1295548   .0311108    -4.16   0.000    -.1905309   -.0685786
                                            |
    cL2.ln_xrdintensity#cL2.Numberofmergers |   1.901935   .4716925     4.03   0.000     .9774353    2.826436
                                            |
                            ln_xrdintensity |
                                        L3. |   1.234194    .981131     1.26   0.208    -.6887879    3.157175
                                            |
                            Numberofmergers |
                                        L3. |  -.0117876   .0560916    -0.21   0.834    -.1217251    .0981499
                                            |
    cL3.ln_xrdintensity#cL3.Numberofmergers |   .5910209   .7531384     0.78   0.433    -.8851033    2.067145
                                            |
                                     ln_emp |
                                        L1. |   1.137954   .1752377     6.49   0.000     .7944947    1.481414
                                            |
                              YearEffective |
                                      2004  |     .00448   .0400853     0.11   0.911    -.0740858    .0830458
                                      2005  |  -.0282953   .0614794    -0.46   0.645    -.1487927     .092202
                                      2006  |   .2280606   .0789065     2.89   0.004     .0734067    .3827146
                                      2007  |   .0188835   .0877563     0.22   0.830    -.1531157    .1908826
                                      2008  |   .0088067   .0907055     0.10   0.923    -.1689729    .1865862
                                      2009  |   .1528882   .0794215     1.93   0.054    -.0027751    .3085515
                                      2010  |   .2519953    .065093     3.87   0.000     .1244154    .3795751
                                            |
                     AcquirorPrimarySICCode |
                                      2836  |          0  (omitted)
                                      3571  |          0  (omitted)
                                      3572  |          0  (omitted)
                                      3577  |          0  (omitted)
                                      3651  |          0  (omitted)
                                      3661  |          0  (omitted)
                                      3663  |          0  (omitted)
                                      3669  |          0  (omitted)
                                      3672  |          0  (omitted)
                                      3674  |          0  (omitted)
                                      3812  |          0  (omitted)
                                      3823  |          0  (omitted)
                                      3825  |          0  (omitted)
                                      3826  |          0  (omitted)
                                      3829  |          0  (omitted)
                                      3841  |          0  (omitted)
                                      3844  |          0  (omitted)
                                      3845  |          0  (omitted)
                                      4812  |          0  (omitted)
                                      4813  |          0  (omitted)
                                      7371  |          0  (omitted)
                                      7372  |          0  (omitted)
                                      7373  |          0  (omitted)
                                      7374  |          0  (omitted)
                                      7375  |          0  (omitted)
                                      7376  |          0  (omitted)
                                      7379  |          0  (omitted)
                                      8731  |          0  (omitted)
    ---------------------------------------------------------------------------------------------------------
    However, If i create the lagged variables manually, which technically should yield the same results:

    Code:
    gen Numerofmergersl1=L.Numberofmergers
    gen Numerofmergersl2=L2.Numberofmergers
    gen Numerofmergersl3=L3.Numberofmergers
    gen ln_xrdintensityl1=L.ln_xrdintensity
    gen ln_xrdintensityl2=L2.ln_xrdintensity
    gen ln_xrdintensityl3=L3.ln_xrdintensityl1
    gen ln_empl1=L.ln_emp
    xtpoisson patents c.ln_xrdintensityl1##c.Numerofmergersl1 c.ln_xrdintensityl2##c.Numerofmergersl2 c.ln_xrdintensityl3##c.Numerofmergersl3 ln_empl1 i.YearEffective i. AcquirorPrimarySICCode, fe vce (robust)
    I get the following results:

    Code:
    Iteration 0:   log pseudolikelihood = -6437.9582  
    Iteration 1:   log pseudolikelihood = -3832.0512  
    Iteration 2:   log pseudolikelihood = -3820.3584  
    Iteration 3:   log pseudolikelihood = -3820.3581  
    
    Conditional fixed-effects Poisson regression         Number of obs    =    857
    Group variable: PERMNO                               Number of groups =    148
    
                                                         Obs per group:
                                                                      min =      2
                                                                      avg =    5.8
                                                                      max =      7
    
                                                         Wald chi2(16)    = 584.18
    Log pseudolikelihood = -3820.3581                    Prob > chi2      = 0.0000
    
                                                               (Std. err. adjusted for clustering on PERMNO)
    --------------------------------------------------------------------------------------------------------
                                           |               Robust
                                   patents | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
    ---------------------------------------+----------------------------------------------------------------
                         ln_xrdintensityl1 |  -2.296605   1.291001    -1.78   0.075    -4.826921    .2337107
                          Numerofmergersl1 |   -.115257   .0396852    -2.90   0.004    -.1930385   -.0374755
                                           |
    c.ln_xrdintensityl1#c.Numerofmergersl1 |   1.630476   .6486697     2.51   0.012     .3591065    2.901845
                                           |
                         ln_xrdintensityl2 |  -.1586907   1.106949    -0.14   0.886    -2.328271     2.01089
                          Numerofmergersl2 |    -.13714   .0460391    -2.98   0.003     -.227375    -.046905
                                           |
    c.ln_xrdintensityl2#c.Numerofmergersl2 |   1.877367   .6627211     2.83   0.005     .5784576    3.176277
                                           |
                         ln_xrdintensityl3 |   1.570527   1.216018     1.29   0.197    -.8128247     3.95388
                          Numerofmergersl3 |  -.0482638   .0450378    -1.07   0.284    -.1365363    .0400087
                                           |
    c.ln_xrdintensityl3#c.Numerofmergersl3 |    1.22589   .6082898     2.02   0.044     .0336637    2.418116
                                           |
                                  ln_empl1 |   1.104463   .1672588     6.60   0.000     .7766416    1.432284
                                           |
                             YearEffective |
                                     2005  |  -.0579629   .0380305    -1.52   0.127    -.1325013    .0165755
                                     2006  |   .1994121   .0529142     3.77   0.000     .0957022    .3031221
                                     2007  |   .0266962   .0737193     0.36   0.717     -.117791    .1711834
                                     2008  |   .0183556     .07759     0.24   0.813    -.1337179    .1704292
                                     2009  |   .1522672   .0596342     2.55   0.011     .0353863    .2691481
                                     2010  |   .2355128   .0539211     4.37   0.000     .1298295    .3411962
                                           |
                    AcquirorPrimarySICCode |
                                     2836  |          0  (omitted)
                                     3571  |          0  (omitted)
                                     3572  |          0  (omitted)
                                     3577  |          0  (omitted)
                                     3651  |          0  (omitted)
                                     3661  |          0  (omitted)
                                     3663  |          0  (omitted)
                                     3669  |          0  (omitted)
                                     3672  |          0  (omitted)
                                     3674  |          0  (omitted)
                                     3812  |          0  (omitted)
                                     3823  |          0  (omitted)
                                     3825  |          0  (omitted)
                                     3826  |          0  (omitted)
                                     3829  |          0  (omitted)
                                     3841  |          0  (omitted)
                                     3844  |          0  (omitted)
                                     3845  |          0  (omitted)
                                     4812  |          0  (omitted)
                                     4813  |          0  (omitted)
                                     7371  |          0  (omitted)
                                     7372  |          0  (omitted)
                                     7373  |          0  (omitted)
                                     7374  |          0  (omitted)
                                     7375  |          0  (omitted)
                                     7376  |          0  (omitted)
                                     7379  |          0  (omitted)
                                     8731  |          0  (omitted)
    --------------------------------------------------------------------------------------------------------
    Why is there a difference and what is the right way?

    Best regards

    Chris

  • #2
    My eye stopped at

    Code:
     
     gen ln_xrdintensityl3=L3.ln_xrdintensityl1
    which is not consistent with your other calculations.

    Comment


    • #3
      Now this is a bit embarrasing. I literally struggled with this problem for 2 hours. Thank you very much Nick, sometimes it can be so easy.

      Chris

      Comment


      • #4
        After 30 years using Stata almost every working day, all I can say is: You never stop making silly mistakes. You do get a bit better at finding them

        Comment


        • #5
          Note that if your objective in creating the lagged variable manually was to circumvent your problem with estat sum discussed in your earlier post at

          https://www.statalist.org/forums/for...-sum-error-498

          a reply I posted there suggests using something along the lines of
          Code:
          summarize patents l(1/3).ln_xrdintensity l(1/3).Numberofmergers  l.ln_emp i.YearEffective i.AcquirorPrimarySICCode if e(sample)
          following the xtpoisson command with lag operators.
          Last edited by William Lisowski; 22 Dec 2021, 12:06.

          Comment


          • #6
            Thank you very much William and Nick. Since the "asdoc" command still does not work even with your handy solution, I still had to work around it with the above code.

            Comment

            Working...
            X