Announcement

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

  • XTDPDBC: new Stata command for bias-corrected estimation of linear dynamic panel data models

    Dear Statalisters,

    Linear dynamic panel data models are commonly estimated by GMM (for example with my command xtdpdgmm). Yet, when all regressors (besides the lagged dependent variable) are strictly exogenous, more efficient alternatives are available. Besides maximum likelihood estimation (for example with my command xtdpdqml), an estimator that directly corrects the dynamic panel data bias (a.k.a. Nickell bias) of the conventional fixed-effects (FE) estimator can be quite attractive because it typically retains the small variance of the FE estimator compared to GMM estimators.

    My new command, xtdpdbc, implements the bias-corrected method of moments estimator described by Breitung, Kripfganz, and Hayakawa (2021). It analytically corrects the first-order condition of the FE estimator, which leads to a set of nonlinear moment conditions that can be solved with conventional numerical methods (Gauss-Newton). Another advantage of this procedure is that a formula of the asymptotic variance-covariance matrix for the calculation of standard errors is readily available, unlike the bias-corrected estimator by Kiviet (1995) that is implemented in the community-contributed xtlsdvc command by Bruno (2005).

    Yet another advantage is that the estimator can accommodate higher-order lags of the dependent variable. Moreover, the moment conditions can be adjusted to create a random-effects (RE) version of the estimator, assuming that all (or some) of the exogenous regressors are uncorrelated with the unobserved group-specific effects. This RE version is not yet implemented in xtdpdbc, but will be added in due course.

    In turns out that under the FE assumption the bias-corrected method of moments estimator is equivalent to the Dhaene and Jochmans (2016) adjusted profile likelihood estimator. Furthermore, if there is only a single lag of the dependent variable, it is also equivalent to the bias-corrected estimator of Bun and Carree (2005).

    It should be noted that due to the nonlinearity of the bias-corrected moment functions, the estimator in general has multiple solutions and the numerical algorithm may not always converge to the correct one. The correct solution is characterized by a negativity condition on the gradient, i.e. all eigenvalues of the gradient should be negative. In the current version of xtdpdbc, the command will display a note if the gradient has positive eigenvalues. In that case, the estimation should be repeated with different starting values (using the from() option) until the correct solution is found. Starting values for the coefficient of the lagged dependent variable should typically be varied over the interval [0, 1]. Starting values for the exogenous regressors do not matter much.

    In some cases, the numerical algorithm might not converge due to an almost flat criterion function. In such a case, it might help to simplify the optimization problem by concentrating out the coefficients of the exogenous regressors with option concentration. If this does not help, formal convergence could possibly be achieved by declaring the option nonrtolerance. However, the results in that case might not be very robust.

    Last but not least, the command also supports unbalanced panel data.

    To install the command, type the following in Stata's command window:
    Code:
    net install xtdpdbc, from(http://www.kripfganz.de/stata/)
    Please see the help file for the fairly standard command syntax and the available options:
    Code:
    help xtdpdbc
    Here is an example with second-order autoregressive dynamics:
    Code:
    . webuse psidextract
    
    . xtdpdbc lwage wks south smsa ms exp exp2 occ ind union, lags(2)
    
    Bias-corrected estimation
    Iteration 0:   f(b) =  .00415219  
    Iteration 1:   f(b) =  7.766e-06  
    Iteration 2:   f(b) =  2.040e-09  
    Iteration 3:   f(b) =  2.132e-16  
    
    Group variable: id                           Number of obs         =      2975
    Time variable: t                             Number of groups      =       595
    
                                                 Obs per group:    min =         5
                                                                   avg =         5
                                                                   max =         5
    
    ------------------------------------------------------------------------------
           lwage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           lwage |
             L1. |   .2777891   .0713708     3.89   0.000     .1379049    .4176733
             L2. |   .0777857   .0411693     1.89   0.059    -.0029045     .158476
                 |
             wks |  -.0000815   .0014887    -0.05   0.956    -.0029992    .0028363
           south |   .0828634   .0950579     0.87   0.383    -.1034466    .2691735
            smsa |  -.0304335   .0293295    -1.04   0.299    -.0879182    .0270513
              ms |  -.0096381   .0294365    -0.33   0.743    -.0673326    .0480565
             exp |     .06042    .012486     4.84   0.000     .0359478    .0848921
            exp2 |  -.0002095   .0001089    -1.92   0.054    -.0004229    3.86e-06
             occ |   -.029654   .0222952    -1.33   0.183    -.0733517    .0140437
             ind |   .0189437    .025248     0.75   0.453    -.0305414    .0684289
           union |  -.0044655    .030205    -0.15   0.882    -.0636661    .0547351
           _cons |   3.283092   .5078034     6.47   0.000     2.287815    4.278368
    ------------------------------------------------------------------------------
    Any comments and suggestions are welcome.

    References:

  • Sebastian Kripfganz
    replied
    A minor update to version 1.3.2 is available for the xtdpdbc package:
    Code:
    net install xtdpdbc, from(http://www.kripfganz.de/stata/) replace
    It highlights in the postestimation help file that the new package xtdpdserial can be used as a postestimation command after xtdpdbc for state-of-the-art serial correlation testing.

    Leave a comment:


  • Sebastian Kripfganz
    replied
    The problem reported in post #37 occured because the dependent variable was specified with a time-series operator (d.). This problem has now been fixed in an update to version 1.3.1 of the xtdpdbc package, available from my personal website:
    Code:
    net install xtdpdbc, from(http://www.kripfganz.de/stata) replace

    Leave a comment:


  • Sebastian Kripfganz
    replied
    This looks like a bug. To investigate it further, I would need to be able to replicate it. Would it be possible for you to send me your data set by e-mail?

    Please initially check whether you have the latest version 1.3.0 of the package:
    Code:
    which xtdpdbc
    If your lagged dependent variable is statistically insignificant, estimating a static model could indeed be an alternative. However, keep in mind that absence of statistical significance does not imply evidence of no effect.

    Leave a comment:


  • Der Lancken
    replied
    Hello Sebastian,
    I've encountered a weird problem when working with your excellent code, i cant run estat serial, ar

    I've looked at your previous posts in this thread about it and I write the same stuff as you do but, i get this error "not sorted"

    You run the same test in post #19 and you just write it like estat serial, ar(1/3) however it doesnt work for me... I've been trying to troubleshoot this for an hour now reading your manual and the help postestimation stuff


    xtdpdbc d.DC REALI d.GFCF GDP_GR INEQ DEREG PORTF, fe vce(robust) lags(2) teffects
    note: 9 groups are dropped due to gaps or insufficient number of observations

    Bias-corrected estimation
    Iteration 0: F(b) = 148.095
    Iteration 1: F(b) = .02383223
    Iteration 2: F(b) = 1.667e-09
    Iteration 3: F(b) = 8.253e-24

    Group variable: countryID Number of obs = 367
    Time variable: Years Number of groups = 14

    Fixed-effects model Obs per group: min = 11
    avg = 26.21429
    max = 35

    (Std. err. adjusted for clustering on countryID)
    ------------------------------------------------------------------------------
    | Robust
    D.DC | Coefficient std. err. z P>|z| [95% conf. interval]
    -------------+----------------------------------------------------------------
    DC |
    LD. | .0852119 .0601579 1.42 0.157 -.0326954 .2031192
    |
    REALI | .0482445 .1950109 0.25 0.805 -.3339698 .4304588
    |
    GFCF |
    D1. | 2.783083 .6950585 4.00 0.000 1.420794 4.145373
    |
    GDP_GR | -.9574042 .4851284 -1.97 0.048 -1.908238 -.0065701
    INEQ | . 4740026 .2616798 1.81 0.070 -.0388804 .9868855
    DEREG | 2.724067 .8431059 3.23 0.001 1.07161 4.376525
    PORTF | -.4726161 .1153936 -4.10 0.000 -.6987835 -.2464487
    |
    Years |
    1983 | -1.293794 2.752904 -0.47 0.638 -6.689387 4.101799
    1984 | -1.305243 2.58306 -0.51 0.613 -6.367948 3.757462
    1985 | -2.800389 2.774858 -1.01 0.313 -8.239011 2.638232
    1986 | 1.377751 4.910492 0.28 0.779 -8.246636 11.00214
    1987 | -4.150164 2.650621 -1.57 0.117 -9.345286 1.044958
    1988 | -2.308038 2.908657 -0.79 0.427 -8.0089 3.392824
    1989 | .2437326 2.780284 0.09 0.930 -5.205524 5.692989
    1990 | -4.973752 2.788143 -1.78 0.074 -10.43841 .4909084
    1991 | -4.982039 3.023606 -1.65 0.099 -10.9082 .9441194
    1992 | -2.638841 2.483588 -1.06 0.288 -7.506585 2.228903
    1993 | -5.31538 2.182822 -2.44 0.015 -9.593632 -1.037127
    1994 | -3.029258 3.151915 -0.96 0.337 -9.206898 3.148382
    1995 | -4.150733 3.036973 -1.37 0.172 -10.10309 1.801624
    1996 | -5.198202 3.127607 -1.66 0.097 -11.3282 .9317954
    1997 | 1.415862 3.209285 0.44 0.659 -4.874221 7.705945
    1998 | -5.155784 3.432988 -1.50 0.133 -11.88432 1.572748
    1999 | .8279091 3.162888 0.26 0.794 -5.371237 7.027056
    2000 | .8915087 8.424864 0.11 0.916 -15.62092 17.40394
    2001 | -.0537508 8.282745 -0.01 0.995 -16.28763 16.18013
    2002 | -8.248197 2.988416 -2.76 0.006 -14.10539 -2.391009
    2003 | -5.384594 3.193444 -1.69 0.092 -11.64363 .8744417
    2004 | -5.91146 3.666597 -1.61 0.107 -13.09786 1.274939
    2005 | -1.718478 2.706641 -0.63 0.525 -7.023398 3.586442
    2006 | -2.914727 3.757536 -0.78 0.438 -10.27936 4.449907
    2007 | -12.96102 6.918338 -1.87 0.061 -26.52071 .5986739
    2008 | -11.25987 6.059859 -1.86 0.063 -23.13697 .6172364
    2009 | -4.639794 3.010552 -1.54 0.123 -10.54037 1.260779
    2010 | -8.451309 3.629645 -2.33 0.020 -15.56528 -1.337336
    2011 | -13.16799 4.381721 -3.01 0.003 -21.756 -4.579972
    2012 | -11.19382 4.062111 -2.76 0.006 -19.15541 -3.232227
    2013 | -7.223011 4.02689 -1.79 0.073 -15.11557 .669548
    2014 | -11.67965 4.766727 -2.45 0.014 -21.02226 -2.337036
    2015 | -8.202296 3.662608 -2.24 0.025 -15.38088 -1.023715
    2016 | -3.849129 3.65336 -1.05 0.292 -11.00958 3.311326
    |
    _cons | -20.48276 8.942092 -2.29 0.022 -38.00893 -2.956579
    ------------------------------------------------------------------------------

    . estat serial, ar(1/2)
    not sorted

    and by the way since my lagged dependent variable isnt significant does that mean that its not necessary to even include it? Should i use another model or something?

    Sorry for bothering you with this, but help would be greatly appreciated


    Leave a comment:


  • Sorphasith jumong
    replied
    Originally posted by Sebastian Kripfganz View Post
    The command should normally work the same way with unbalanced panels as with balanced panels. Just note that dynamic models require that there are no gaps in your time series.
    Ok, I got it, Many thanks

    Leave a comment:


  • Sebastian Kripfganz
    replied
    The command should normally work the same way with unbalanced panels as with balanced panels. Just note that dynamic models require that there are no gaps in your time series.

    Leave a comment:


  • Sorphasith jumong
    replied
    Dear Sebastian,

    Many thanks for creating new useful Stata command, can you please explain more the command of xtdpdbc to implement with unbalanced panel data ? Thank you

    Leave a comment:


  • Sebastian Kripfganz
    replied
    Israel Garcia
    I am afraid the answer is that xtdpdbc does not currently support suest. I have made a note on my to-do list but I cannot promise a quick update.

    My suggestion would be to use my xtdpdqml command instead, which often yields very similar results to xtdpdbc. To use suest, you need to specify the option mlparams with xtdpdqml.

    Leave a comment:


  • Israel Garcia
    replied
    Hi Sebastian,
    Having a great time using your command for my research. I was trying to perform a kind of out-of-sample test for my estimated coefficients by restricting the sample size and then adding more observations. I thought of using
    Code:
    suest
    given that your command allows for predict, however I always get the same error:
    estimated with a nonstandard vce (conventional)
    .
    Do you have a solution within the
    Code:
    suest
    environmnet or perhaps trying a different approach?
    Thanks a lot and Merry Christmas!

    Leave a comment:


  • Fan Zheng
    replied
    Originally posted by Sebastian Kripfganz View Post
    This error occurs when Stata cannot find the command's Mata library, which can happen if the command was not properly installed. Restarting Stata might help. Did you install the xtdpdbc package using the ssc or net install command? Sometimes typing the following in the command window helps to make Stata aware of the Mata library:
    Code:
    mata mata mlib index
    Problem solved!
    As you suggested, I restarted Stata and typed the code. It's running now. I installed using ssc.
    Thanks a lot.

    Leave a comment:


  • Sebastian Kripfganz
    replied
    Originally posted by Fan Zheng View Post
    I met a problem when using it, stata reported an error:
    <istmt>: 3499 xtdpdbc_init() not found
    This error occurs when Stata cannot find the command's Mata library, which can happen if the command was not properly installed. Restarting Stata might help. Did you install the xtdpdbc package using the ssc or net install command? Sometimes typing the following in the command window helps to make Stata aware of the Mata library:
    Code:
    mata mata mlib index

    Leave a comment:


  • Fan Zheng
    replied
    Hi Sebastian,
    Thank you for contributing this useful command. I met a problem when using it, stata reported an error:
    <istmt>: 3499 xtdpdbc_init() not found
    From the help file, I guess it's about specifying the initial values of the coefficients.The ducument says that the initial values are taken from FE-estimator by default, but it didn't work for my case.
    So do I need to run xtreg to get the estimates first and then use it as the input for your `from' option?

    Leave a comment:


  • Sebastian Kripfganz
    replied
    No, as with the traditional fixed-effects estimator, the exogeneity of the regressors is an identifying assumption which cannot be checked. You would need to use a different estimator, e.g. GMM.

    Leave a comment:


  • Tiyo Ardiyono
    replied
    Hi Sebastian,

    Can we test if the exogenous assumption of the explanatory variables is valid in XTDPDBC?

    Leave a comment:

Working...
X