Announcement

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

  • Ramsey test

    Hi,

    Which is the command in Stata 12 for the Ramsey Test with data panel?

    Thanks!


  • #2
    Daniel:
    Stata does not have a built-in command for that (ie, something similar to -estat ovtest- after -regress-).
    However, you can pretty easily try something alonge the line of -linktest-:
    Code:
    . use "http://www.stata-press.com/data/r15/nlswork.dta"
    
    
    . xtreg ln_wage age, fe
    
    Fixed-effects (within) regression               Number of obs     =     28,510
    Group variable: idcode                          Number of groups  =      4,710
    
    R-sq:                                           Obs per group:
         within  = 0.1026                                         min =          1
         between = 0.0877                                         avg =        6.1
         overall = 0.0774                                         max =         15
    
                                                    F(1,23799)        =    2720.20
    corr(u_i, Xb)  = 0.0314                         Prob > F          =     0.0000
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |   .0181349   .0003477    52.16   0.000     .0174534    .0188164
           _cons |   1.148214   .0102579   111.93   0.000     1.128107     1.16832
    -------------+----------------------------------------------------------------
         sigma_u |  .40635023
         sigma_e |  .30349389
             rho |  .64192015   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(4709, 23799) = 8.81                 Prob > F = 0.0000
    
    
    . predict fitted, xb
    (24 missing values generated)
    
    . g sq_fitted=fitted^2
    (24 missing values generated)
    
    . xtreg ln_wage fitted sq_fitted , fe
    
    Fixed-effects (within) regression               Number of obs     =     28,510
    Group variable: idcode                          Number of groups  =      4,710
    
    R-sq:                                           Obs per group:
         within  = 0.1087                                         min =          1
         between = 0.1006                                         avg =        6.1
         overall = 0.0865                                         max =         15
    
                                                    F(2,23798)        =    1451.88
    corr(u_i, Xb)  = 0.0440                         Prob > F          =     0.0000
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          fitted |   7.143466    .478902    14.92   0.000     6.204788    8.082144
       sq_fitted |  -1.816243    .141469   -12.84   0.000    -2.093531   -1.538955
           _cons |  -5.167788   .4037984   -12.80   0.000    -5.959259   -4.376317
    -------------+----------------------------------------------------------------
         sigma_u |   .4039153
         sigma_e |  .30245467
             rho |  .64073314   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(4709, 23798) = 8.74                 Prob > F = 0.0000
    
    . test sq_fitted=0
    
     ( 1)  sq_fitted = 0
    
           F(  1, 23798) =  164.83
                Prob > F =    0.0000
    
    .
    The -test- outcome points towards a misspecification of -xtreg ln_wage age,fe-, which sounds reasonable, as the original code includes one predictor only.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Perfect!!!!! Thank you so much!!! Carlo Lazzaro !!!!

      Comment

      Working...
      X