Announcement

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

  • OLS and fixed effect's coefficient is exactly the opposite

    Dear All,

    I have some problem.

    I want to know in a period of time , the firm's patent characteristic how to affect the firm's performance.

    So I regress the equation " reg Y a b c d e "

    Y is the firm's performance , other variable are some firm's characteristic and patent characteristic.

    But the problem is manufacturer in the same year maybe have many patents.

    So I add a variable to group with the year and do the "xtset" to solve problem which PANEL DATA must only have an observation value for a year.

    But the coefficient is exactly the opposite when I use the OLS and fixed effect.

    ( I mean if "A" variable is I concern , the A's coefficient is exactly the opposite when I use the OLS and fixed effect.)

    Is this possible or have any method to slove it ?


    Thanks

  • #2
    Click image for larger version

Name:	within_vs_between.png
Views:	1
Size:	12.2 KB
ID:	1385137
    It would have been better if you had showed the actual commands you ran and the actual output from Stata, as it is possible that you have made an error somewhere that is not apparent from your description.

    That said, there is actually nothing surprising about what you see. Fixed-effects regression is a purely within-panel estimation. That is, it looks only at how changes in variable a within a firm are associated with changes in variable Y in that same firm over time. It does not at all take into account whether firms differ in their "baseline" values of a, and whether that baseline value might also affect Y. By contrast, OLS regression accounts for both the within and between firm affects of the predictor variables on the outcome. The important point is that the within and between effects can run in opposite directions. A simple and clear example is provided by the following code:

    Code:
    clear
    set obs 5
    gen panel_id = _n
    expand 2
    
    set seed 1234
    by panel_id , sort: gen y = 4*panel_id - _n + 3 + rnormal(0, 0.5)
    by panel_id: gen x = panel_id + _n
    
    xtset panel_id 
    
    xtreg y x, fe
    regress y x
    
    //    GRAPH THE DATA TO SHOW WHAT'S HAPPENING
    separate y, by(panel_id)
    
    graph twoway connect y? x || lfit y x
    Try it. The graph will look like the graph shown at the top of this post. You can see clearly that within panel in this data, the x y relationship assessed by -xtreg, fe- has a negative slope, whereas the overall relationship, assessed by -regress- has a strongly positive slope.

    So what you need to do now is assess your research goals. Are they served by estimating the within panel associations of your predictors with the outcome, or are they served by estimating the between panel associations? Choose your regression command accordingly.

    Comment


    • #3
      Hi:

      This is my code:

      Code:
      gen mydate = mdy(month,day,year)
      
      egen new = group(code mydate)
      
      xtset firmnumber new
      
      
      . xtreg performance A B C D E , fe
      
      Fixed-effects (within) regression               Number of obs     =        576
      Group variable: firmnumber                      Number of groups  =         56
      
      R-sq:                                           Obs per group:
           within  = 0.0093                                         min =          1
           between = 0.0064                                         avg =       10.3
           overall = 0.0095                                         max =        240
      
                                                      F(5,515)          =       0.96
      corr(u_i, Xb)  = -0.0247                        Prob > F          =     0.4398
      
      ------------------------------------------------------------------------------
       performance |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
                 A |  -.1237464   .0786427    -1.57   0.116    -.2782463    .0307535
                 B |  -.0340555   .0358236    -0.95   0.342    -.1044338    .0363228
                 C |   .0006287   .0227175     0.03   0.978    -.0440017    .0452591
                 D |    -.00004   .0004739    -0.08   0.933     -.000971    .0008909
                 E |  -.0037588   .0043184    -0.87   0.384    -.0122426     .004725
             _cons |   .4461557   .3862604     1.16   0.249    -.3126841    1.204996
      -------------+----------------------------------------------------------------
           sigma_u |  .75855669
           sigma_e |  .16088974
               rho |  .95695031   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      F test that all u_i=0: F(55, 515) = 70.78                    Prob > F = 0.0000
      
      
      
      . reg performance A B C D E
      
            Source |       SS           df       MS      Number of obs   =       576
      -------------+----------------------------------   F(5, 570)       =      3.61
             Model |  3.61571254         5  .723142507   Prob > F        =    0.0032
          Residual |  114.099505       570  .200174569   R-squared       =    0.0307
      -------------+----------------------------------   Adj R-squared   =    0.0222
             Total |  117.715217       575  .204722117   Root MSE        =    .44741
      
      ------------------------------------------------------------------------------
       performance |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
                 A |   .2908821   .2044132     1.42   0.155    -.1106129    .6923772
                 B |  -.0216593    .012672    -1.71   0.088    -.0465487    .0032302
                 C |  -.0303136    .011398    -2.66   0.008    -.0527008   -.0079263
                 D |   .0009377   .0012003     0.78   0.435    -.0014197    .0032952
                 E |    .007406   .0114313     0.65   0.517    -.0150466    .0298587
             _cons |   .5389345   .1473218     3.66   0.000     .2495746    .8282944
      ------------------------------------------------------------------------------

      code is the number of each firm's patent


      In this output can see when run the fixed effect , A's t-value is -1.57 , but regress the OLS , t-value become 1.42


      It's annoying

      Comment


      • #4
        Thanks for showing the code and results. You're not doing anything wrong. This data behaves like the example I showed in #2: the within-firm and between-firm effects of A run in opposite directions. Reality does not always make life easy for us!

        Comment

        Working...
        X