Announcement

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

  • Autocorrelation Testing with Categorical data


    Hello everyone,

    I'm conducting a panel data regression with a continuous dependent variable (Share price - SP), one categorical independent variable (TYPE OF INDUSTRY - TYPE) and other three continuous independent variables. During serial correlation testing using the Wooldridge test, I encountered an error indicating that factor variables and time-series operators are not permitted in the command 'xtserial SP1 DPS1 DPR1 RR1 i.TYPE.

    Considering this,
    01. Is it acceptable to execute the command without explicitly identifying the variable's categorical nature? example: xtserial SP1 DPS1 DPR1 RR1 TYPE
    02. If not what would be the most suitable approach for assessing autocorrelation under such circumstances?

  • #2
    Suren:
    the -xi:- prefix is the answer to your query:
    Code:
    . use "https://www.stata-press.com/data/r18/nlswork.dta"
    (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
    
    . xtreg ln_wage i.race, re
    
    Random-effects GLS regression                   Number of obs     =     28,534
    Group variable: idcode                          Number of groups  =      4,711
    
    R-squared:                                      Obs per group:
         Within  = 0.0000                                         min =          1
         Between = 0.0198                                         avg =        6.1
         Overall = 0.0186                                         max =         15
    
                                                    Wald chi2(2)      =      99.02
    corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
         ln_wage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
            race |
          Black  |  -.1300382    .013486    -9.64   0.000    -.1564702   -.1036062
          Other  |   .1011474   .0562889     1.80   0.072    -.0091768    .2114716
                 |
           _cons |   1.691756   .0071865   235.41   0.000     1.677671    1.705841
    -------------+----------------------------------------------------------------
         sigma_u |  .38195681
         sigma_e |  .32028665
             rho |  .58714668   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    . help xtserial
    
    . xtserial ln_wage i.race
    factor-variable and time-series operators not allowed
    r(101);
    
    . xi: xtserial ln_wage i.race
    i.race            _Irace_1-3          (naturally coded; _Irace_1 omitted)
    
    Wooldridge test for autocorrelation in panel data
    H0: no first-order autocorrelation
        F(  1,    1530) =    134.775
               Prob > F =      0.0000
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo, I appreciate your valuable insights and expertise on this matter. Thank you for your contribution.

      Comment

      Working...
      X