Page 1 of 1

IRF from a single equation in panel format

Posted: Sat Sep 30, 2017 8:21 am
by RomainR
Dear all,
I would like to obtain the IRF with confidence bands for the univariate autoregressive model in panel data (my dataset comprises 21 countries and 38 observations but I want to estimate the model only for 17 countries).
I try to adapt to an equation in panel form the code posted by T. Doan (05/27/2011) :

Code: Select all

linreg(define=baseeqn) y
# y{1} dummy{0 1}
*
modify baseeqn yeqn
vreplace y with yboot
set yboot = y
equation(empty) dummyeqn dummy 
group bimodel yeqn dummyeqn
*
compute ndraws=10000
compute nsteps=20
*
declare vect[rect] %%responses
*
dim %%responses(ndraws)
do draw=1,ndraws
   uforecast(boot,equation=baseeqn) yboot
   linreg(equation=yeqn,noprint)
   impulse(model=bimodel,shocks=||0.0,1.0||,results=impulses,steps=nsteps,noprint)
   dim %%responses(draw)(2,nsteps)
   ewise %%responses(draw)(i,j)=ix=%vec(%xt(impulses,j)),ix(i)
end do draws
*
@mcgraphirf(model=bimodel,shocklabels=||"To Dummy"||,varlabels=||"Y"||,include=||1||)
(https://estima.com/forum/viewtopic.php? ... ARMA#p4871 )

The equation and the variables are strictly the same, I just replaced

linreg(define=baseeqn) y; # y{1} dummy{0 1}

by

pregress(method=fixed,noprint,effects=both,smpl=panelsmpl,define=baseeqn) y; # y{ 2} dummy{0 1};

because I want to estimate my baseline panel model with both fixed effects and time effects.
Next, in the loop generating the draws I replaced

linreg(equation=yeqn,noprint)

by

pregress(method=fixed,noprint,effects=both,smpl=panelsmpl,equation=yeqn)

but it does not work. Maybe my way to adapt the original code to a panel equation is not correct.
I would like to know if anyone can help me to fix that point.
Thanks,
Best,
Romain
Ps: enclosed the RATS program and the database.

Re: IRF from a single equation in panel format

Posted: Tue Oct 03, 2017 8:23 am
by RomainR
No one has an idea to fix the problem?
Thanks,
Best
Romain

Re: IRF from a single equation in panel format

Posted: Tue Oct 03, 2017 7:17 pm
by TomDoan
Bootstrapping in panel data is a lot more complicated than it is in straight time series data. UFORECAST with BOOT isn't designed to handle the many possible assumptions that can be used. The following is from the Panel/Grouped Data e-course.
Panel data gives us additional problems, in the sense that the data can have
correlations in both directions, but also can offer additional opportunities.

There are basically five ways to bootstrap in panel data:

1. You can resample all i; t.
2. You can resample i, then resample t within the record for i.
3. You can resample t, then resample i within the record for t.
4. You can resample i with the time direction fixed.
5. You can resample t with the individual direction fixed.

Type 1 is most similar to boostrapping in cross section data, but requires the
strongest assumptions about the behavior of the data. The other types are only
possible in panel data, and allow bootstrapping in situations where they would
be impossible for single time series or single cross sections.
Of those, the phrase "panel bootstrap" would generally apply to #4, that is, switching entire individual records. That keeps the time order intact within individuals (in case that matters) but requires that you have enough individuals to make resampling that way meaningful.

Re: IRF from a single equation in panel format

Posted: Wed Oct 04, 2017 2:15 am
by RomainR
Dear Tom,
Thanks for your quick reply. I will have a look on the panel e-course to find a solution.
Best.
Romain