how to estimate the panel var model

Questions related to panel (pooled cross-section time series) data.
luxu1983
Posts: 61
Joined: Wed Aug 12, 2009 10:53 pm

how to estimate the panel var model

Unread post by luxu1983 »

dear
how to estimate the panle var model
thanks a lot
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: how to estimate the panel var model

Unread post by TomDoan »

Which panel VAR model?
luxu1983
Posts: 61
Joined: Wed Aug 12, 2009 10:53 pm

Re: how to estimate the panel var model

Unread post by luxu1983 »

TomDoan wrote:Which panel VAR model?
yit=b*yit-1+eit
yit=(x1it,x2it)' ;b:coefficiences
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: how to estimate the panel var model

Unread post by TomDoan »

As you have that described, you can just read the data with a panel CALENDAR, and do a VAR the same way you would for regular time series data. The ESTIMATE instruction (and LINREG and most other instructions) respects the boundaries between individuals in a panel data set.
luching
Posts: 64
Joined: Mon Jun 07, 2010 4:05 pm

Re: how to estimate the panel var model

Unread post by luching »

Hi Tom, Suppose, instead of using the panel calendar, I stack up the panel data as an artificial long time series and estimate the VAR. Is it the case that the main difference in my approach is the boundary? Also, if I use the panel calendar, how would one take care of fixed effects?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: how to estimate the panel var model

Unread post by TomDoan »

luching wrote:Hi Tom, Suppose, instead of using the panel calendar, I stack up the panel data as an artificial long time series and estimate the VAR. Is it the case that the main difference in my approach is the boundary?
Correct. Unless you use a SMPL option to avoid it, one individual will lag back into the end of the previous individual.
luching wrote: Also, if I use the panel calendar, how would one take care of fixed effects?
That's a whole different matter because that's a dynamic model with fixed effects. For small T, big N, the method typically used is that from Holtz-Eakin, Newey and Rosen. With small N, big T, an obvious question is whether fixed coefficients across individuals are necessary/desirable. The Panel Data course has a chapter on Panel VAR's which includes both the fixed lag coefficients with fixed effects approach and use of shrinkage estimators to allow the lag coefficients to vary (somewhat) from individual to individual.
luching
Posts: 64
Joined: Mon Jun 07, 2010 4:05 pm

Re: how to estimate the panel var model

Unread post by luching »

Hi Tom, I am trying to do a standard cholesky impulses using a panel VAR. I created the panel data using the pform command. It seems the impulses are sensitive to the ordering of the countries in the panel. Is it something wrong with the panel data I created. The relevant section of the code is as follows:

dec vec[string] varlabels(nvarall)
dec vec[ser] y(nvarall)
comp k = 0
dofor ser = GDP VIX
comp k = k+1
comp varlabels(k) = %l(ser)
pform(block=capt) y(k) 1 capt*ncoun
# ser
labels y(k)
# varlabels(k)
end
*
cal(q,panelobs=capt) 2001:1
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: how to estimate the panel var model

Unread post by TomDoan »

How are the input data structured? I'm not really understanding what the PFORM instruction is supposed to be doing here.
luching
Posts: 64
Joined: Mon Jun 07, 2010 4:05 pm

Re: how to estimate the panel var model

Unread post by luching »

Each input series is a single column stacked by countries. That is:
GDP
ARG1980
ARG1981
ARG1982
ARG1983
...
ARG2012
CHL1980
CHL1981
CHL1982
CHL1983
...

Also, it seems after doing the "pform", if I were to tell RATS to estimate using the whole panel then the relevant sample is not 1980:2012, but 1980:1980*ncountries. This makes me suspect the panel is not constructed correctly.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: how to estimate the panel var model

Unread post by TomDoan »

Isn't that annual, not quarterly? Assuming you have full blocks of 33 years per country, it looks like you just need

compute ncount=numberofcountries
cal(a,panelobs=33) 1980:1
data(options for reading data) 1//1980:1 ncount//2012:1 gdp vix

If the data are already properly blocked, you don't have to use PFORM---just set the panel-dated CALENDAR. PFORM is for handling data that aren't properly blocked.
luching
Posts: 64
Joined: Mon Jun 07, 2010 4:05 pm

Re: how to estimate the panel var model

Unread post by luching »

Thanks Tom. This gave me the same panel structure as pform. When I copied out the panel, it does preserve the panel structure (dates repeat). But while estimating a VAR, it does not seem to recognize the sample size. For instance, if I restrict the estimation sample to 2001:1 2014:4, this seems to take only the data for the first country. And if want to include the entire panel I need to "extend" the estimation time period. That makes me suspect if the model estimation is taking into account the panel structure. If that is not the case and the estimation simply takes a "stacked" sample, the ordering of the countries will matter as I suspect. Please advise.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: how to estimate the panel var model

Unread post by TomDoan »

See page UG-411 in the User's Guide for selecting samples in a panel data set.
luching
Posts: 64
Joined: Mon Jun 07, 2010 4:05 pm

Re: how to estimate the panel var model

Unread post by luching »

Thanks. I see that without specifying the sample during estimation, it takes the full sample. But I am still trying to understand the more conceptual issue with regard to a panel VAR: if the ordering of countries matter while constructing the panel, then there seems to be something missing. Is this a fundamental issue with PVARs?
luching
Posts: 64
Joined: Mon Jun 07, 2010 4:05 pm

Re: how to estimate the panel var model

Unread post by luching »

I think I found the problem. My panel is unbalanced and I used NA's to fill out some entries. Whenever the first entry is an NA, then there are some issues. Otherwise, it seems fine. The PVAR is no longer subject to ordering of countries. Many thanks Tom.
Post Reply