[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
JensMehrhoff@web.de |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Simulation of a Panel VAR |

Date |
Fri, 02 Nov 2007 14:38:33 +0100 |

Dear Stata users, I'm trying to simulate (not to estimate) a bivariate Panel VAR(p) with Random Effects. The variables are prices and quantities which are taken from a specific group of goods (eg wrist watches). The panel should account for the heterogeneity of prices and quantities within the group of goods and the VAR should capture the relationship between prices and quantities. If anyone has comments on this, I would very much appreciate them. What I'm looking for is a procedure to simulate the disturbance terms (the model itself is a completely different problem), where v_gi denotes the random effect of the i-th cross section in the g-th equation (g = p, q) and u_git the random error in period t. I assume a rather simple covariance structure, ie neither serial nor cross correlation of the u's and v's; both are independent and homoskedastic. Let (1) w_git = u_git + v_gi, then (2) Var(w_gi) is a T x T matrix with Var(u_g) + Var(v_g) on the diagonal and Var(v_g) off the diagonal, and (3) Cov(w_pi,w_qi) is a diagonal matrix with elements Cov(u_p,u_q). (4) Var(w) is equal to [I # Var(w_pi), I # Cov(w_pi,w_qi), I # Var(w_qi)], where I is the n x n identity matrix and # denotes the Kronecker product. Var(w) is 2nT x 2nT, so I'm having trouble with large simulations (T = 100, n = 1,000) as Stata's limitation on matsize is 11,000, at least if there is no other possibility to simulate these random numbers from the multivariate normal than the Cholesky decomposition (-drawnorm- wasn't really helpful in a Panel VAR framework). The result should be two series - w_1it and w_2it - with nT observations. The only thing I have is Var(w). How could I simulate these two series given this covariance matrix? (Var(w) and the code I have written so far is below - is X = vec(wp wq) distributed as desired?) Many thanks in advance. symmetric var_w[8,8] c1: c1: c2: c2: c1: c1: c2: c2: c1 c2 c1 c2 c1 c2 c1 c2 r1:r1 30 r1:r2 20 30 r2:r1 0 0 30 r2:r2 0 0 20 30 r1:r1 -5 0 0 0 70 r1:r2 0 -5 0 0 40 70 r2:r1 0 0 -5 0 0 0 70 r2:r2 0 0 0 -5 0 0 40 70 clear set matsize 800 set more off scalar drop _all matrix drop _all scalar n = 2 scalar T = 2 scalar var_up = 10 scalar var_vp = 20 scalar var_uq = 30 scalar var_vq = 40 scalar cov_upuq = -5 matrix var_wp = I(n) # (var_up * I(T) + J(T,T,var_vp)) matrix var_wq = I(n) # (var_uq * I(T) + J(T,T,var_vq)) matrix cov_wpwq = I(n) # (cov_upuq * I(T)) matrix var_w = (var_wp, cov_wpwq\ cov_wpwq, var_wq) matrix A = cholesky(var_w) matrix N = matuniform(2*n*T,1) local i = 1 while `i' < 2*n*T { matrix N[`i',1] = invnormal(N[`i',1]) local i = `i' +1 } matrix X = A * N matrix wp = X[1..n*T, 1] quietly svmat wp rename wp1 wp matrix wq = X[n*T+1..2*n*T, 1] svmat wq rename wq1 wq egen crossid = fill(1 1 2 2) egen dateid = fill(1 2 1 2) xtset crossid dateid ______________________________________________________________________________ Jetzt neu! Im riesigen WEB.DE Club SmartDrive Dateien freigeben und mit Freunden teilen! http://www.freemail.web.de/club/smartdrive_ttc.htm/?mc=021134 * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**RE: st: Avoiding scientific notation in test statistics** - Next by Date:
**Re: st: How to start writing your own estimation command** - Previous by thread:
**st: How to start writing your own estimation command** - Next by thread:
**Re: st: misaligned labels when spanning multiple lines** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |