Friday, 15 September 2017

Panel ARDL using STATA

#First of all, I would like to acknowledge that I m the following material from the paper title as "Estimation of nonstationarity heterogeneous panel data" published by Stata journal (2007). and Ibn_Abdullah - PhD@INCEIF's Research Tips blog,

First a little bit about panel ardl and in the bottom, we have Stata commands


Preconditions regarding stationarity of panel ARDL
We can run ARDL model in three cases
When all variables are stationary at level
When all variables are stationary at first difference
Or when variables are stationary at level and first difference means in mixture nature stationarity …
Suppose I have 6 variables suppose 3 stationary at level and 3 at first difference so I can go now for
Panel ARDL model , Remember we can’t run ardl when we have second difference variable.

Panel ARDL

Pooled Mean Group (PMG) model

The main characteristic of PMG is that it allows short-run coefficients, including the intercepts, the
speed of adjustment to the long-run equilibrium values, and error variances to be heterogeneous
country by country, while the long-run slope coefficients are restricted to be homogeneous across
countries. This is particularly useful when there are reasons to expect that the long-run equilibrium
relationship between the variables is similar across countries or, at least, a sub-set of them. The
short-run adjustment is allowed to be country-specific, due to the widely different impact of the
vulnerability to financial crises and external shocks, stabilization policies, monetary policy and so on.
However, there are several requirements for the validity, consistency, and efficiency of this
methodology. First, the existence of a long-run relationship among the variables of interest requires the coefficient on the error–correction term to be negative and not lower than -2. Second, an important assumption for the consistency of the ARDL model is that the resulting residual of the error-correction model be serially uncorrelated and the explanatory variables can be treated as exogenous. Such conditions can be fulfilled by including the ARDL (p,q) lags for the dependent (p) and independent variables (q) in error correction form. Third, the relative size of T and N is crucial, since when both of them are large this allows us to use the dynamic panel technique, which helps to avoid the bias in the average estimators and resolves the issue of heterogeneity. Eberhardt and Teal (2010) argue that the treatment of heterogeneity is central to understanding the growth process. Therefore, failing to fulfill these conditions will produce inconsistent estimation in PMG. The PMG estimator constrains the long-term coefficients to be the same across countries and allows only the short-term coefficients to vary.

Mean Group (MG) estimator
The second technique (MG) introduced by Pesaran and Smith, (1995) calls for estimating separate
regressions for each country and calculating the coefficients as unweight means of the estimated
coefficients for the individual countries. This does not impose any restrictions. It allows for all
coefficients to vary and be heterogeneous in the long-run and short-run. However, the necessary
condition for the consistency and validity of this approach is to have a sufficiently large time-series
dimension of the data. The cross-country dimension should also be large (to include about 20 to 30
countries). Additionally, for small N the average estimators (MG) in this approach are quite sensitive tooutliers and small model permutations (see Favara, 2003).

Dynamic Fixed Effects (DFE) modelFinally, the dynamic fixed effects estimator (DFE) is very similar to the PMG estimator and imposes
restrictions on the slope coefficient and error variances to be equal across all countries in the long run.The DFE model further restricts the speed of adjustment coefficient and the short-run coefficient to beequal too. However, the model features country-specific intercepts. DFE has cluster option to estimate intra-group correlation with the standard error (Blackburne and Frank, 2007). Nevertheless, Baltagi, Gri, and Xiong (2000) point out that this model is subject to a simultaneous equation bias due to the endogeneity between the error term and the lagged dependent variable in case of small sample size.

PANEL ARDL USING STATA
1) import your data file into stata
2) now create a pool or simple stata give codes to each cross section or entity like if you have different countries data or companies the u have to give specific code all countries or companies, further if you have assign code by yourself suppose u did not write company name like “nestles” but you indicated nestle with 111 now u see you have already given the code but if you have simple right the name of company then u need to give also code
                   egen country1=group( country) (note: if you have countries data)
                    egen Company1=group( Company) (note: if you have companies data)
3) now set time which is most important
4) xtset Company1 year, yearly (note: hear I have yearly data and company1 is new variable which I generate in step 2)
5) First of all install this package to run PANEL ARDL ―ssc install xtpmg, replace‖
6) Suppose you think you have installed this package but still you are not sure then type in command bar‖ type xtpmg‖
7) If u see the message of no found then install otherwise you have already installed it.
8) here we shall Run PMG (average):
10) (The main characteristic of PMG is that it allows short-run coefficients, including the intercepts, the speed of adjustment to the long-run equilibrium values, and error variances to be heterogeneous country by country, while the long-run slope coefficients are restricted to be homogeneous across countries.)
xtpmg d.CO2 d.energy d.gdp , lr(l.CO2 energy gdp ) ec(ECT) replace pmg 
11) here we shall Run PMG (individual):
xtpmg d.CO2 d.energy d.gdp , lr(l.CO2 energy gdp ) ec(ECT) replace full pmg
 Here we shall Run MG (average):
xtpmg d.CO2 d.energy d.gdp , lr(l.CO2 energy gdp ) ec(ECT) replace mg
 Here we shall Run MG (individual):
(It allows for all coefficients to vary and be heterogeneous in the long-run and short-run. However, the necessary condition for the consistency and validity of this approach is to have a sufficiently large time-series dimension of the data.)
xtpmg d.CO2 d.energy d.gdp , lr(l.CO2 energy gdp ) ec(ECT) replace full mg
 Hausman test to choose between MG and PMG:
  hausman mg pmg, sigmamore

Now if our probability value comes more than 5% we run PMG
If our probability value comes less than 5% we run MG
  • Running DFE:
  • xtpmg d.CO2 d.energy d.gdp , lr(l.CO2 energy gdp ) ec(ECT) replace dfe
 Running Hausman test to choose between MG and DFE:
hausman mg DFE, sigmamore 
Note:
Suppose you want to run all these tests on your data, so simple just import your data into stata and copy command from here into stata command bar and replace my variables name with yours.
Good luck.





0 comments:

Search