Han-Phillips Dynamic Panel Estimation

Very important notice: Please update the Stata xthp module (xthp.ado). This version works correctly with `if'.

The R Program

Download

[NEW] Download xthp.R (right-click and save the link as xthp.R). This R module can handle weakly exogenous regressors.

Usage

  1. Copy the file to your working directory.
  2. Run as the following example:
    source("xthp.R")
    
    dat <- read.csv("stata-data.csv")
    ivec <- dat$id
    tvec <- dat$year
    
    n <- length(unique(ivec))
    
    ## The following lines are important
    y  <- to.regular.panel(dat$y, ivec,tvec)
    x1 <- to.regular.panel(dat$x1,ivec,tvec)
    x2 <- to.regular.panel(dat$x2,ivec,tvec)
    w1 <- to.regular.panel(dat$w1,ivec,tvec)
    ## y:  dependent, (x1,x2): strictly exogenous,
    ## w1: weakly exogenous
    
    xthp(y,n=n)  # simple univariate dynamic panel
    hp <- xthp(y,x=cbind(x1,x2),w=w1,n=n)
    print(hp$coefficients)
    
    The first line of the $coefficients is for the AR(1) coefficient. The rests are for the strictly exogenous regressors (X1, X2) and the weakly exogenous regressors (W1).

Notes

  1. Estimates with only strictly exogenous regressors seem alright. But I haven't tested the validity of the program for models with weakly exogenous regressors.
  2. Strictly exogenous regressors are handled by LSDV.
  3. Weakly exogenous regressors are handled by FOD (forward orthogonal deviation) transformation. Instruments are BOD (backward orghotnal deviation) transformed regressors. (Search Google for FOD and BOD.) Note that the Stata module cannot handle weakly exogenous regressors.

The Stata Module

Download

Download xthp.ado (right-click and save the link as xthp.ado). Download the paper here.

Installation

  1. Start Stata and determine the personal ado directory. This can be done by running sysdir in the Stata session and reading the output line starting with PERSONAL.
  2. Copy the saved xthp.ado into this directory. (If the directory does not exist, create it.)
  3. Restart Stata, or run discard.

Usage

  1. Open a stata dataset.
  2. Run tsset to set the cross-sectional index and the time-series index (only once).
  3. Run xthp with proper arguments.
    1. No exogenous variable: "xthp y"
    2. With exogenous variables: "xthp y x1 x2 x3"
  4. Note: When exogenous variables are included, the LSDV estimation is performed for them.

Examples

use oildata
tsset country year
xthp oil
xthp oil if year>1981
xthp oil lny lnp if year>1990

Contact

Summary of Han and Phillips (2006)

The Han and Phillips's (2006) estimator for the panel AR(1) model

yit=ai+uit,     uit=r uit-1+eit,

where eit is iid across i and t is the OLS estimator (excluding the constant term) of the transformed dependent variable 2dyit+dyit-1 on dyit-1, where the d notation stands for the first difference operator. This estimator is consistent for all AR coefficient in (-1,1], and is asymptotically normal as NT increases. The standard error should be calculated in a customized way. It is remarkable that

  1. the r estimate is consistent for all r value including unity; and
  2. the asymptotics holds as NT increases regardless of the N/T ratio.

When exogenous variables are present as in

yit=ai+b xit + uit,

so

yit-b xit=ai + uit,    yit-r yit-1 = ai* + b(xit-r xit-1) + eit,

where ai*=ai(1-r), the r parameter and the b parameter can be determined simultaneously or one-by-one repeatedly using the above two equations. The current ado file estimates b using LSDV on the second equation based on the assumption that xit are strictly exogenous.