Announcement

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

  • Code oder

    I have a problem when running the regression i different order that I get different results.

    When I start with
    Code:
    generate UNd = UN > 0 if !missing(UN)
    gen COL  = GEOG9 | GEOG10
    gen CILfbnl  = GEOG2 | GEOG3 | GEOG5 |GEOG6
    gen CILgsa = GEOG1 | GEOG4|GEOG8
    gen CIL3s  = GEOG7
    gen CILa  = GEOG1 | GEOG2 | GEOG3 | GEOG4 | GEOG5 |GEOG6| GEOG7|GEOG8
    gen ROAh = (ROA[_n-1]+ROA[_n-2])/2
    (993 missing values generated)
    xtreg ROA LEV SI TAN GR UNd ROAh if inrange(YR, 2006,2014), re vce(robust)
    I get highly significant values for ROAh.

    Code:
    Random-effects GLS regression                   Number of obs      =      4637
    Group variable: NAL                             Number of groups   =       628
    
    R-sq:  within  = 0.0615                         Obs per group: min =         1
           between = 0.8622                                        avg =       7.4
           overall = 0.5228                                        max =         9
    
                                                    Wald chi2(6)       =    175.86
    corr(u_i, X)   = 0 (assumed)                    Prob > chi2        =    0.0000
    
                                      (Std. Err. adjusted for 628 clusters in NAL)
    ------------------------------------------------------------------------------
                 |               Robust
             ROA |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             LEV |  -.0571362   .0140619    -4.06   0.000     -.084697   -.0295754
              SI |  -.0029792   .0017249    -1.73   0.084      -.00636    .0004016
             TAN |  -.0065258   .0113214    -0.58   0.564    -.0287153    .0156636
              GR |   .0832668    .053251     1.56   0.118    -.0211032    .1876368
             UNd |  -.0184099   .0087413    -2.11   0.035    -.0355426   -.0012772
            ROAh |   .6550986   .0937106     6.99   0.000     .4714293    .8387679
           _cons |   .1241849   .0274837     4.52   0.000     .0703179    .1780519
    -------------+----------------------------------------------------------------
         sigma_u |   .0289885
         sigma_e |  .06835332
             rho |  .15244111   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    When I change the regression order from first generating UNd, then the ROAh and then the COL and CIL Variables it get ROAH missing Vaues of 1062 an an insignficant result for the regresioncoefficient ROAh.

    The ROAh command is a follow:
    Code:
    gen ROAh = (ROA[_n-1]+ROA[_n-2])/2
    What could be the Problem? Could it be that I cames from the problem that Stata deletes listwise and thus the generating porces is influenced by this?

  • #2
    I have seen that the problem coms from the ROAh Variable as she is not good specified so therefore changes values as the range of data changes.

    So my new question is how I can creat such a history Varibale which creates always the mean of the las to years of ROA. May datastet contains values from 2004-2014, but my regression starts by 2006-2014.

    ROAh 2006 = mean over ROA 2004 and 2005 and so on.

    Comment


    • #3
      I remember I commented on this in an earlier post.
      The code
      Code:
       gen ROAh = (ROA[_n-1]+ROA[_n-2])/2
      makes little sense. These ROA belonged to individual firms (or whatever ID variable you were using). Without telling Stata that it should regard the ROA of one firm only, it will look at the entire dataset. It will simply use the current sort order of your data and disregard if the variables are from one firm or the other, or from what year they are. This means that the variable created may result in completely different values at any point, depending on the sort order of your data at that moment.

      As stated before in the post linked above, you should do something along the lines of:
      Code:
      xtset NAL YR
      bys NAL: gen ROAh = (ROA[_n-1]+ROA[_n-2])/2
      edit: this bit seems to have had an error on my side actually. Corrected now

      Further, I think you need to take a step back. I am not sure that what you are attempting to do with the rest of your first block of code makes much sense. You don't seem to use many of the variables created there in your regression
      It is probably a good idea if you first explain what you want these variables to be, and provide a data sample using dataex (see here) so that people can give you code that uses the proper variable names for your dataset.
      Last edited by Jorrit Gosens; 11 Feb 2016, 07:13.

      Comment


      • #4
        Thank you Jorrit and you are right. I have seen know where my problem is, and it seems to be correct, also it seems to be correct if i create the varibale you gave me th ecode for. There was somewhere an error and I started to do it again from the beginning on.


        Now it works, so many thanks!

        Comment

        Working...
        X