Announcement

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

  • xtpcse with ols coefficients and ar(1) standard errors

    Dear users,

    I have a panel with n=40 states and t=30 years which I would like to estimate with the xtpcse command (Linear regression with panel-corrected standard errors).

    My questions is whether there is a way to use the xtpcse command with OLS estimated coefficients and ar(1) corrected standard errors.

    The xtpcse by default uses OLS but switches to GLS (prais-weinstein) as soon as the ar(1) option is included.


    This question was already raised in this old thread https://www.stata.com/statalist/arch.../msg00098.html with no resolutive answers.


    Thank you so much.

    Sasha


  • #2
    You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters (what you actually ran), readable Stata output, and sample data using dataex.

    I'm not sure that it makes sense to use GLS for the standard errors but not the coefficients. You might consider xtgls. If you really need this,you could run it both ways and then calculate the t's using the standard error from the OLS estimate with the coefficients from the GLS estimates.

    Comment


    • #3
      Thank you for your reply.

      What I would need are OLS coefficients and some kind of AR(1)-robust standard errors, an option that is not implemented with the xtpcse command. I need this in order to not affect the OLS coefficients, which would be altered by any GLS estimation (such as the cor(ar1) option in xtpcse and the xtgls estimation).

      If I understand well you are suggesting to use xtgls for the coefficients, but this would not give the OLS coefficients I need.

      I have just found that xtscc command seems to do what I need but assuming an ma(q) structure.




      Last edited by Sasha Dubois; 19 May 2019, 09:09.

      Comment


      • #4
        Unfortunately, xtscc relies on large T so that's not a viable option.

        Comment


        • #5
          I have a panel with n=40 states and t=30 years which I would like to estimate with the xtpcse command (Linear regression with panel-corrected standard errors). My questions is whether there is a way to use the xtpcse command with OLS estimated coefficients and ar(1) corrected standard errors. The xtpcse by default uses OLS but switches to GLS (prais-weinstein) as soon as the ar(1) option is included.
          I am not sure why you want to do this. Even though the OLS estimator is consistent in this instance, it is biased. I think that all that you need to do is to switch the variance matrix, but I am not advocating this.

          Code:
          webuse grunfeld, clear
          *AR1 STANDARD ERRORS
          xtpcse invest mvalue kstock, correlation(ar1)
          *SAVE VARIANCE MATRIX
          mat V= e(V)
          *OLS COEFFICIENTS
          xtpcse invest mvalue kstock
          *DEFINE PROGRAM
          program switchV, eclass
          ereturn repost V=V
          end
          *RUN IT
          switchV
          *WANTED?
          est replay



          Results:

          Code:
          . *AR1 STANDARD ERRORS
          
          . 
          . xtpcse invest mvalue kstock, correlation(ar1)
          (note: estimates of rho outside [-1,1] bounded to be in the range [-1,1])
          
          Prais-Winsten regression, correlated panels corrected standard errors (PCSEs)
          
          Group variable:   company                       Number of obs     =        200
          Time variable:    year                          Number of groups  =         10
          Panels:           correlated (balanced)         Obs per group:
          Autocorrelation:  common AR(1)                                min =         20
                                                                        avg =         20
                                                                        max =         20
          Estimated covariances      =        55          R-squared         =     0.5468
          Estimated autocorrelations =         1          Wald chi2(2)      =      93.71
          Estimated coefficients     =         3          Prob > chi2       =     0.0000
          
          ------------------------------------------------------------------------------
                       |           Panel-corrected
                invest |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                mvalue |   .0950157   .0129934     7.31   0.000     .0695492    .1204822
                kstock |    .306005   .0603718     5.07   0.000     .1876784    .4243317
                 _cons |  -39.12569   30.50355    -1.28   0.200    -98.91154    20.66016
          -------------+----------------------------------------------------------------
                   rho |   .9059774
          ------------------------------------------------------------------------------
          
          . xtpcse invest mvalue kstock
          
          Linear regression, correlated panels corrected standard errors (PCSEs)
          
          Group variable:   company                       Number of obs     =        200
          Time variable:    year                          Number of groups  =         10
          Panels:           correlated (balanced)         Obs per group:
          Autocorrelation:  no autocorrelation                          min =         20
                                                                        avg =         20
                                                                        max =         20
          Estimated covariances      =        55          R-squared         =     0.8124
          Estimated autocorrelations =         0          Wald chi2(2)      =     637.41
          Estimated coefficients     =         3          Prob > chi2       =     0.0000
          
          ------------------------------------------------------------------------------
                       |           Panel-corrected
                invest |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                mvalue |   .1155622   .0072124    16.02   0.000      .101426    .1296983
                kstock |   .2306785   .0278862     8.27   0.000     .1760225    .2853345
                 _cons |  -42.71437   6.780965    -6.30   0.000    -56.00482   -29.42392
          ------------------------------------------------------------------------------
          
          . 
          . est replay
          
          -------------------------------------------------------------------------------------------------------------------------------------------
          active results
          -------------------------------------------------------------------------------------------------------------------------------------------
          
          Linear regression, correlated panels corrected standard errors (PCSEs)
          
          Group variable:   company                       Number of obs     =        200
          Time variable:    year                          Number of groups  =         10
          Panels:           correlated (balanced)         Obs per group:
          Autocorrelation:  no autocorrelation                          min =         20
                                                                        avg =         20
                                                                        max =         20
          Estimated covariances      =        55          R-squared         =     0.8124
          Estimated autocorrelations =         0          Wald chi2(2)      =     637.41
          Estimated coefficients     =         3          Prob > chi2       =     0.0000
          
          ------------------------------------------------------------------------------
                       |           Panel-corrected
                invest |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                mvalue |   .1155622   .0129934     8.89   0.000     .0900956    .1410287
                kstock |   .2306785   .0603718     3.82   0.000     .1123519    .3490051
                 _cons |  -42.71437   30.50355    -1.40   0.161    -102.5002    17.07148
          ------------------------------------------------------------------------------








          Comment


          • #6
            Thank you so much for your reply.

            If I understand well, you are mixing the OLS coefficients and the GLS s.e. generated with the corr(ar1) option. But as you say this is not a viable option.

            What I am trying to get (if exists) is some form of correction of the errors which takes into account the AR1 structure, without using GLS, but correcting the variance matrix of the OLS coefficients generated with xtpcse in order to get robust standard errors.

            It should be something similar to this command in R: https://www.rdocumentation.org/packa.../topics/vcovBK

            Thank you.


            Last edited by Sasha Dubois; 20 May 2019, 04:59.

            Comment


            • #7
              From a quick glance of the examples in the R link, the underlying model is random effects, so look at

              Code:
              help xtregar
              for a random effects model with AR1 disturbances. For wide panels, i.e., N> T, clustering using the panel variable will result in standard errors that are robust to heteroskedasticity and arbitrary forms of autocorrelation, including AR(1). Another option is to use newey standard errors on panel data (see newey2 from SSC) or Driscoll-Kraay (see xtscc, ivreg2 or ivreghdfe, all from SSC), but the latter as you note relies on \(T\rightarrow \infty\).

              Comment


              • #8
                Thank you so much!

                Comment

                Working...
                X