Announcement

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

  • Stationarity test for residual in panel data

    Hello everyone,
    I want to test the statinarity (panel) for the residual in my regression.
    I use
    Code:
    predict r
    But through the test when I go to:
    Longitudinal/panel data>unit root test
    And select the test I got error.
    my model is fixed effect and panel
    .

    Many thanks for your valuable time and advice.

    Best regards

  • #2
    It is hard to determine what caused the error when we don't know what the error was.

    In the xtunitroot dialog you should select the dependent variable in your model. If you didn't select any variable, that would generate an error which you clicked the OK button in the dialog box.

    If you selected your predicted value r, that was a mistake, and perhaps that would generate a "no observations" error, or some other error, in your Stata Results window.

    Otherwise, copy from your Stata Results window the xtunitroot command that Stata generated and the error message it gave and post it here, again using CODE delimiters.

    Comment


    • #3
      @William Lisowski thank you so much for your reply. actually I select "r" , so it is my mistake and I recieve this error:

      Code:
      . asdoc reghdfe f(0).tot_birth l(0/2)dum_recession l(1/2)tot_birth , absorb( i.ifscode year) vce(cluster ifscode) nest reset dec(6)
      (File Myfile.doc already exists, option append was assumed)
      (MWFE estimator converged in 3 iterations)
      
      HDFE Linear regression                            Number of obs   =      3,116
      Absorbing 2 HDFE groups                           F(   5,    141) =    6530.91
      Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                        R-squared       =     0.9998
                                                        Adj R-squared   =     0.9998
                                                        Within R-sq.    =     0.9512
      Number of clusters (ifscode) =        142         Root MSE        =     0.0218
      
                                     (Std. Err. adjusted for 142 clusters in ifscode)
      -------------------------------------------------------------------------------
                    |               Robust
          tot_birth |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      --------------+----------------------------------------------------------------
      dum_recession |
                --. |  -.0011832   .0015607    -0.76   0.450    -.0042685    .0019022
                L1. |  -.0018752   .0013405    -1.40   0.164    -.0045252    .0007748
                L2. |   .0007233   .0012545     0.58   0.565    -.0017567    .0032033
                    |
          tot_birth |
                L1. |   1.323623   .0588983    22.47   0.000     1.207185     1.44006
                L2. |  -.3680806   .0538483    -6.84   0.000    -.4745351   -.2616261
                    |
              _cons |   .5614883    .088636     6.33   0.000      .386261    .7367157
      -------------------------------------------------------------------------------
      
      Absorbed degrees of freedom:
      -----------------------------------------------------+
       Absorbed FE | Categories  - Redundant  = Num. Coefs |
      -------------+---------------------------------------|
           ifscode |       142         142           0    *|
              year |        22           0          22     |
      -----------------------------------------------------+
      * = FE nested within cluster; treated as redundant for DoF computation

      Code:
       predict r
      (option xb assumed; fitted values)
      (291 missing values generated)
      
      . xtunitroot llc r
      Levin-Lin-Chiu test requires strongly balanced data
      r(498);
      my adviser told me: after taking the residual of the regression do a test of stationarity (Panel) for residual . I am so thankful to recieve your advice.

      many thanks for your valuable time and advice.

      best regards,

      Comment


      • #4
        hello everyone, I hope I could receive your advice soon. many thanks,

        best regards,

        Comment


        • #5
          You have several issues in #3

          predict r (option xb assumed; fitted values) (291 missing values generated)
          -residual- is an option of predict, and therefore should be preceded by a comma. Your code is predicting the dependent variable, and Stata is explicitly telling you this. You want

          Code:
          predict, res
          Secondly, if I recall correctly, only xtunitroot fisher handles unbalanced panels. See

          Code:
          help xtunitroot

          Comment


          • #6
            @Andrew Musau thank you so much for your reply, I did in this way. I have some problem in terms of the interpretation. so as I expect, it is non-stationary data and I can reject the null hypothesis. am I right? but it is based on the unit root of residual. I hope I could recieve your advice.
            Code:
             reghdfe f(0).lnfertility l(0/2)dum_recession l(1/2)lnfertility , absorb( i.ifscode year) vce(cluster ifscode) residuals(res)
            (MWFE estimator converged in 3 iterations)
            
            HDFE Linear regression                            Number of obs   =      3,116
            Absorbing 2 HDFE groups                           F(   5,    141) =    6592.37
            Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                              R-squared       =     0.9998
                                                              Adj R-squared   =     0.9998
                                                              Within R-sq.    =     0.9493
            Number of clusters (ifscode) =        142         Root MSE        =     0.0190
            
                                           (Std. Err. adjusted for 142 clusters in ifscode)
            -------------------------------------------------------------------------------
                          |               Robust
              lnfertility |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            --------------+----------------------------------------------------------------
            dum_recession |
                      --. |  -.0013254   .0015998    -0.83   0.409    -.0044881    .0018372
                      L1. |  -.0015468   .0011184    -1.38   0.169    -.0037579    .0006642
                      L2. |    .000273   .0010136     0.27   0.788    -.0017309    .0022769
                          |
              lnfertility |
                      L1. |   1.316072   .0545001    24.15   0.000     1.208329    1.423815
                      L2. |    -.36521   .0512967    -7.12   0.000    -.4666201      -.2638
                          |
                    _cons |   .8267416   .1036365     7.98   0.000     .6218594    1.031624
            -------------------------------------------------------------------------------
            
            Absorbed degrees of freedom:
            -----------------------------------------------------+
             Absorbed FE | Categories  - Redundant  = Num. Coefs |
            -------------+---------------------------------------|
                 ifscode |       142         142           0    *|
                    year |        22           0          22     |
            -----------------------------------------------------+
            * = FE nested within cluster; treated as redundant for DoF computation
            Code:
            
            
            Code:
            . predict r, resid
            (292 missing values generated)
            Code:
            
            
            Code:
            . xtunitroot fisher r, dfuller lags(0)
            (292 missing values generated)
            
            Fisher-type unit-root test for r
            Based on augmented Dickey-Fuller tests
            --------------------------------------
            Ho: All panels contain unit roots           Number of panels       =    142
            Ha: At least one panel is stationary        Avg. number of periods =  21.94
            
            AR parameter: Panel-specific                Asymptotics: T -> Infinity
            Panel means:  Included
            Time trend:   Not included
            Drift term:   Not included                  ADF regressions: 0 lags
            ------------------------------------------------------------------------------
                                              Statistic      p-value
            ------------------------------------------------------------------------------
             Inverse chi-squared(284)  P      2180.3843       0.0000
             Inverse normal            Z       -34.7407       0.0000
             Inverse logit t(714)      L*      -49.9196       0.0000
             Modified inv. chi-squared Pm       79.5705       0.0000
            ------------------------------------------------------------------------------
             P statistic requires number of panels to be finite.
             Other statistics are suitable for finite or infinite number of panels.
            ------------------------------------------------------------------------------
            Code:
            
            
            best regards,
            Last edited by Khati Zolfaghari; 27 Aug 2021, 04:53.

            Comment


            • #7
              The null hypothesis is that all panels have a unit root. So a significant test implies that at least one panel is stationary. The Hadri Lagrange multiplier test (implemented as xtunitroot hadri) has the null that all panels are stationary. It requires large \(T\) and moderate \(N\).

              Comment


              • #8
                @Andrew Musau thank you so much for your reply.

                Comment


                • #9
                  Hello everyone, I get the first differences and run again the regression and I take the result, but when I test the unit root test of the resduals , it stay the same and non stations,
                  what should I do?
                  Best regards

                  Comment


                  • #10
                    Hello and good day , I need your assistance. I hope I recieve your help .

                    best regards,

                    Comment

                    Working...
                    X