Announcement

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

  • Forecast with panel data techniques

    I am trying to use panel data techniques as a forecasting tools, although little research is dedicated to it. Generally, forecasting in a traditional sense is somehow related to time-series econometric. However, Baltaigi (2008) notes various benefits with panel data forecasts, so I want to fallow this avenue as it suits my data-setting better.

    I have a balanced panel for 93 countries, 2000-2024 period (few years obviously are predictions) for some variables, but 2000-2018 for other variables including my dependent variable. it is not a huge sample for GMM , but i apply it (just to try it. in a more perfect world I should have larger N and smaller T). These are my results.


    Code:
    Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
    Warning: Number of instruments may be large relative to number of observations.
    Warning: Two-step estimated covariance matrix of moments is singular.
      Using a generalized inverse to calculate optimal weighting matrix for two-step estimation.
      Difference-in-Sargan/Hansen statistics may be negative.
    
    Dynamic panel-data estimation, two-step system GMM
    ------------------------------------------------------------------------------
    Group variable: country3                        Number of obs      =      1763
    Time variable : year                            Number of groups   =        93
    Number of instruments = 98                      Obs per group: min =        18
    F(30, 92)     =   1243.86                                      avg =     18.96
    Prob > F      =     0.000                                      max =        19
    ------------------------------------------------------------------------------
                 |              Corrected
           lny   |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           ly   |
             L1. |    .374036   .0687893     5.44   0.000     .2374146    .5106574
                 |
          lng     |   .6740826   .1040717     6.48   0.000     .4673872     .880778
              eu |  -.3168764   .1618267    -1.96   0.053    -.6382782    .0045253
           O... |    .007962   .0034658     2.30   0.024     .0010786    .0148454
           lne   |   .0054246   .0267454     0.20   0.840    -.0476942    .0585433
                 |
            year |
           2000  |          0  (empty)
           2001  |  -3.293952   .8267903    -3.98   0.000    -4.936029   -1.651875
           2002  |  -3.275765   .8331387    -3.93   0.000    -4.930451    -1.62108
           2003  |  -3.051059   .8255846    -3.70   0.000    -4.690741   -1.411377
           2004  |  -2.963923   .8386126    -3.53   0.001     -4.62948   -1.298366
           2005  |  -2.991701   .8578211    -3.49   0.001    -4.695408   -1.287995
           2006  |  -2.742058   .8313055    -3.30   0.001    -4.393103   -1.091014
           2007  |  -2.619339   .8606872    -3.04   0.003    -4.328738   -.9099403
           2008  |  -2.739219   .8337378    -3.29   0.001    -4.395095   -1.083344
           2009  |  -3.107684   .8435374    -3.68   0.000    -4.783022   -1.432346
           2010  |  -2.925138   .8636608    -3.39   0.001    -4.640443   -1.209834
           2011  |   -2.81268   .8808837    -3.19   0.002    -4.562191   -1.063169
           2012  |  -2.915922   .8721009    -3.34   0.001     -4.64799   -1.183854
           2013  |   -3.02399   .8874551    -3.41   0.001    -4.786553   -1.261428
           2014  |  -3.044528   .8826193    -3.45   0.001    -4.797486    -1.29157
           2015  |  -3.103196   .8773961    -3.54   0.001     -4.84578   -1.360611
           2016  |  -3.004841   .8713689    -3.45   0.001    -4.735455   -1.274228
           2017  |  -3.010357   .8898926    -3.38   0.001    -4.777761   -1.242954
           2018  |  -3.065278   .8937723    -3.43   0.001    -4.840387   -1.290169
           2019  |  -3.582186   .8513228    -4.21   0.000    -5.272986   -1.891385
           2020  |          0  (omitted)
           2021  |          0  (omitted)
           2022  |          0  (omitted)
           2023  |          0  (omitted)
           2024  |          0  (omitted)
                 |
           _cons |          0  (omitted)
    ------------------------------------------------------------------------------
    Instruments for first differences equation
      Standard
        D.(O   eu lne   2000b.year 2001.year 2002.year 2003.year 2004.year
        2005.year 2006.year 2007.year 2008.year 2009.year 2010.year 2011.year
        2012.year 2013.year 2014.year 2015.year 2016.year 2017.year 2018.year
        2019.year 2020.year 2021.year 2022.year 2023.year 2024.year)
      GMM-type (missing=0, separate instruments for each period unless collapsed)
        L(1/3).lng  
        L(1/3).L.lny   collapsed
    Instruments for levels equation
      Standard
        open3 eu lnexc 2000b.year 2001.year 2002.year 2003.year 2004.year
        2005.year 2006.year 2007.year 2008.year 2009.year 2010.year 2011.year
        2012.year 2013.year 2014.year 2015.year 2016.year 2017.year 2018.year
        2019.year 2020.year 2021.year 2022.year 2023.year 2024.year
        _cons
      GMM-type (missing=0, separate instruments for each period unless collapsed)
        D.lng  
        D.L.lny   collapsed
    ------------------------------------------------------------------------------
    Arellano-Bond test for AR(1) in first differences: z =  -3.60  Pr > z =  0.000
    Arellano-Bond test for AR(2) in first differences: z =   1.61  Pr > z =  0.108
    ------------------------------------------------------------------------------
    Sargan test of overid. restrictions: chi2(67)   = 152.25  Prob > chi2 =  0.000
      (Not robust, but not weakened by many instruments.)
    Hansen test of overid. restrictions: chi2(67)   =  81.44  Prob > chi2 =  0.110
      (Robust, but weakened by many instruments.)
    
    Difference-in-Hansen tests of exogeneity of instrument subsets:
      GMM instruments for levels
        Hansen test excluding group:     chi2(47)   =  59.47  Prob > chi2 =  0.105
        Difference (null H = exogenous): chi2(20)   =  21.97  Prob > chi2 =  0.342
      gmm(L.lnfdi, collapse lag(1 3))
        Hansen test excluding group:     chi2(63)   =  75.13  Prob > chi2 =  0.141
        Difference (null H = exogenous): chi2(4)    =   6.31  Prob > chi2 =  0.177
      iv(O eu lne 2000b.year 2001.year 2002.year 2003.year 2004.year 2005.year 2006.year 2007.ye ar 2008.year 2009.year 2010.year 2011.year 2012.year 2013.year 2014.year 2015.year 2016.year 2017.year 2018.year 2019.year 2020.year 2021.year 2022.year 2023.year 2024.year)
        Hansen test excluding group:     chi2(46)   =  63.23  Prob > chi2 =  0.047
        Difference (null H = exogenous): chi2(21)   =  18.21  Prob > chi2 =  0.636
    I am aware that the model could be improved, following Roodman 2009 (especially related to Sargan Hansen test, but let's ignore it). Then following forecast command which in stata help also states the following

    forecast works with both time-series and panel datasets. time-series datasets may not contain any gaps, and panel datasets must be strongly balanced.
    I apply forecast following the steps suggested. I want to get out of sample forecast for 2020 - 2024 period

    Code:
     estimates store spec1  //first step
    
     forecast create spec1forecast, replace //second step
      Forecast model spec1forecast started
    
    forecast estimates spec1                      //3rd step
        forecast will use the default type of prediction for xtabond2. Verify this is appropriate;
        see xtabond2 postestimation. Use the predict() option with forecast estimates to override
        the default.
    
     Added estimation results from xtabond2.
      Forecast model spec1forecast now contains 1 endogenous variable.
    
    
     forecast solve, prefix(f_) begin(year(2000)) end (year(2024))  //step
    begin(year(2019)) out of range
        Time variable year runs from 2000 through 2024.
    r(459);
    why do I get this message in the 4th step? I change the beginning year to 2019 but that does not help.
    Does anyone have experience with foresting with panel?

    Thanks!

    Reference:
    Roodman, D. (2009). How to do xtabond2: An introduction to difference and system GMM in Stata. The stata journal, 9(1), 86-136.
    Baltagi, B. H. (2008). Forecasting with panel data. Journal of forecasting, 27(2), 153-173.
    Last edited by Mina Wu; 07 Jan 2020, 03:35.

  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output and sample data using dataex. You'll also improve your chances if you post a simplified problem - extremely long posts are hard on the reader.

    Comment


    • #3
      Thanks. It is the results output that is long. I was trying to be concise.

      Comment

      Working...
      X