Page 1 of 1
Simulate Contemporaneous Correlative Panel Data sets
Posted: Mon Oct 03, 2011 12:52 am
by iloverats
Dear
I want do some simulations for panel unit root test
How can i simulate Contemporaneous Correlative Panel Data sets?
May you give me examples
thank you very much
Re: Simulate Contemporaneous Correlative Panel Data sets
Posted: Mon Oct 03, 2011 4:38 pm
by TomDoan
This would appear to do that.
Code: Select all
*
* Generate panel data with unit roots, heterogeneous stationary parts
* and disturbances correlated across individuals.
*
* Procedure from Chang(2004), "Bootstrap Unit Root Tests in Panels with
* Cross-Sectional Dependency", Journal of Econometrics, vol. 120, no 2,
* 263-293.
*
compute tdim=30,ndim=8
compute rmin=.1
*
cal(panel=tdim)
all ndim//tdim
*
* Draw sigma with eigenvalues in [rmin,1.0]
*
dec symm sigma(ndim,ndim)
dec rect uu(ndim,ndim)
dec vect evalues(ndim)
compute uu=%uniform(0.0,1.0)
compute hh=%qrdecomp(uu)(1)
ewise evalues(i)=%uniform(rmin,1.0)
compute sigma=hh*%diag(evalues)*tr(hh)
*
* Draw AR coefficients for individuals
*
dec vect rho(ndim)
ewise rho(i)=%uniform(-.8,.8)
*
* Get ergodic distribution for AR's
*
dec symm sigma0(ndim,ndim)
ewise sigma0(i,j)=sigma(i,j)/(1-rho(i)*rho(j))
*
compute f0=%decomp(sigma0)
compute f =%decomp(sigma)
*
set u 1 ndim//tdim = 0.0
*
* Draw from ergodic distribution for U for first period.
*
compute [vector] u0=%ranmvnormal(%decomp(sigma0))
do indiv=1,ndim
compute u(indiv//1)=u0(indiv)
end do indiv
*
* Generate heterogeneous AR processes with correlated disturbances.
*
do time=2,tdim
compute u0=rho.*u0+%ranmvnormal(f)
do indiv=1,ndim
compute u(indiv//time)=u0(indiv)
end do indiv
end do time
*
* Transform to unit root process
*
set y = %if(%period(t)==1,u,y{1}+u)
Re: Simulate Contemporaneous Correlative Panel Data sets
Posted: Mon Oct 03, 2011 7:48 pm
by iloverats
dear sir
thank you very much
please tell me how can i set the" Contemporaneous Correlative coefficient " bewteen the u(it)?
thank you

Re: Simulate Contemporaneous Correlative Panel Data sets
Posted: Mon Oct 03, 2011 8:00 pm
by TomDoan
iloverats wrote:dear sir
thank you very much
please tell me how can i set the" Contemporaneous Correlative coefficient " bewteen the u(it)?
thank you

That's the SIGMA matrix. If you want to set that rather than draw it, go ahead.