@ CESLDU.PRG @ @ This program solves the expenditure share problem discussed in @ @ Section 6 of Binder and Pesaran (1999) using the LDU factorization @ @ procedure described in Proposition 5.1 of Binder and Pesaran (1999). @ @ @ @ The program returns the optimal expenditure shares for TT-t+1 periods, @ @ where the first period, t, and the terminal period, TT, can be chosen @ @ by the user. @ @ There are three commodity groups in the model considered in this @ @ program, and the adjustment costs are allowed to be of second order. @ @ @ @ If you find any error in this program, please send e-mail to: @ @ binder "at" glue.umd.edu @ @ Copyright: Michael Binder and M. Hashem Pesaran @ @ Current Version: 03/02/2000 @ @ @ @ The paper 'Solution of Finite-Horizon Multivariate Linear @ @ Rational Expectations Models and Sparse Linear Systems' @ @ describing the theory underlying this program can be @ @ downloaded from: @ @ http://www.inform.umd.edu/econ/mbinder @ @ and @ @ http://www.econ.cam.ac.uk/faculty/pesaran @ @ @ @ See the user notes at the first of these two URL's before using @ @ this program. @ new; output file=cesldu.out reset; @ Specify Parameter Values (Notation as in Binder and Pesaran, 1999) @ beta = .96; alpha = zeros(3,1); alpha[1,1] = .2994; alpha[2,1] = .5053; alpha[3,1] = 1-alpha[1,1]-alpha[2,1]; delta = zeros(3,1); delta[1,1] = -.2361; delta[2,1] = .3228; delta[3,1] = -delta[1,1]-delta[2,1]; omega0 = zeros(3,1); omega0[1,1] = .5384; omega0[2,1] = .3054; omega0[3,1] = .1562; GGamma = zeros(3,3); GGamma[1,1] = .2695; GGamma[1,2] = -.1154; GGamma[1,3] = -.1541; GGamma[2,1] = GGamma[1,2]; GGamma[2,2] = -.0420; GGamma[2,3] = .1575; GGamma[3,1] = GGamma[1,3]; GGamma[3,2] = GGamma[2,3]; GGamma[3,3] = -GGamma[3,1]-GGamma[3,2]; aa = zeros(4,1); aa[1,1] = .0115; aa[2,1] = .0183; aa[3,1] = .0098; aa[4,1] = .0146; R = zeros(4,4); R[1,1] = .8472; R[1,2] = .1443; R[1,3] = -.0298; R[1,4] = -.0669; R[2,1] = .0431; R[2,2] = .8774; R[2,3] = -.0581; R[2,4] = -.0552; R[3,1] = .1459; R[3,2] = .2044; R[3,3] = .7217; R[3,4] = -.1515; R[4,1] = .0177; R[4,2] = .1861; R[4,3] = -.0786; R[4,4] = .7811; Sigmav = zeros(4,4); Sigmav[1,1] = .0132; Sigmav[2,2] = .0154; Sigmav[3,3] = .0182; Sigmav[4,4] = .0127; H = zeros(3,3); H[1,1] = .9; H[1,2] = .2; H[1,3] = .4; H[2,1] = H[1,2]; H[2,2] = .6; H[2,3] = .1; H[3,1] = H[1,3]; H[3,2] = H[2,3]; H[3,3] = .7; G = zeros(3,3); G[1,1] = 4; G[1,2] = .3; G[1,3] = .1; G[2,1] = G[1,2]; G[2,2] = 2; G[2,3] = .05; G[3,1] = G[1,3]; G[3,2] = G[2,3]; G[3,3] = .5; K = zeros(3,3); K[1,1] = 2; K[1,2] = .1; K[1,3] = .02; K[2,1] = G[1,2]; K[2,2] = 1; K[2,3] = .005; K[3,1] = G[1,3]; K[3,2] = G[2,3]; K[3,3] = .2; t = 1; TT = 100; @ Model Solution @ @ Transform System to Canonical Form @ @ x[t+tau] = A * x[t+tau-1] + B * E(x[t+tau+1]|I[t+tau]) @ @ + w[t+tau] @ @ w(t+tau] = D0 + D1 * m[t+tau] @ @ m[t+tau] = aa + R * m[t+tau-1] + v[t+tau] @ M00 = H+(1+beta)*G+(1+4*beta+beta^2)*K; M10 = G+2*(1+beta)*K; M20 = -K; M01 = beta*M10; M02 = beta^2*M20; iota = {1, 1, 1}; theta = 1/(iota'*inv(M00)*iota); N = eye(3)-theta*iota*iota'*inv(M00); A = inv(M00)*N*M10~inv(M00)*N*M20~zeros(3,3)|eye(3)~zeros(3,6)|zeros(3,9); B = inv(M00)*N*M01~zeros(3,3)~inv(M00)*N*M02|zeros(3,9)|eye(3)~zeros(3,6); D0 = inv(M00)*N*H*alpha+theta*inv(M00)*iota|zeros(6,1); tempv = GGamma-delta*omega0'~delta; D1 = inv(M00)*N*H*tempv|zeros(6,4); sstar = inv(eye(9)-A-B)*(D0+D1*inv(eye(4)-R)*aa); dim1 = rows(A); dim4 = cols(D1); @ Carry Out Recursions @ captheta = zeros((TT-t+1)*dim1,dim1); @ The Matrix captheta Contains the Matrices Theta[1], Theta[2], ..., @ @ Theta[TT-t+1] in Equation (5.11) of Binder and @ @ Pesaran (1999) @ capr = zeros((TT-t+1)*dim1,1); capp = zeros((TT-t+1)*dim1,1); capq = zeros((TT-t+1)*dim1,dim4); caps = zeros((TT-t+1)*dim1,1); @ The Matrices capr, capp, capq, and caps Are Used Below to @ @ Compute the Conditional Expectations E(Gamma[TT-t+1]|I[t]) @ @ in Equation (5.13) of Binder and Pesaran (1999) @ captheta[1:dim1,.] = eye(dim1); capr[1:dim1,.] = D0; capp[1:dim1,.] = zeros(dim1,1); capq[1:dim1,.] = D1; caps[1:dim1,.] = B*sstar; i = 1; do while i <= TT-t; captheta[i*dim1+1:(i+1)*dim1,.] = eye(dim1)-B* inv(captheta[(i-1)*dim1+1:i*dim1,.])*A; capr[i*dim1+1:(i+1)*dim1,.] = inv(captheta[i*dim1+1:(i+1)*dim1,.])*B *capr[(i-1)*dim1+1:i*dim1,.] +inv(captheta[i*dim1+1:(i+1)*dim1,.])*D0; capq[i*dim1+1:(i+1)*dim1,.] = inv(captheta[i*dim1+1:(i+1)*dim1,.])*B *capq[(i-1)*dim1+1:i*dim1,.]*R +inv(captheta[i*dim1+1:(i+1)*dim1,.])*D1; capp[i*dim1+1:(i+1)*dim1,.] = inv(captheta[i*dim1+1:(i+1)*dim1,.])*B *capq[(i-1)*dim1+1:i*dim1,.]*aa +inv(captheta[i*dim1+1:(i+1)*dim1,.])*B *capp[(i-1)*dim1+1:i*dim1,.]; caps[i*dim1+1:(i+1)*dim1,.] = inv(captheta[i*dim1+1:(i+1)*dim1,.])*B *caps[(i-1)*dim1+1:i*dim1,.]; i = i+1; endo; @ Model Simulation @ rndseed 20742; v = rndn(4,TT-t+1+100); v[1,.] = Sigmav[1,1]*v[1,.]; v[2,.] = Sigmav[2,2]*v[2,.]; v[3,.] = Sigmav[3,3]*v[3,.]; v[4,.] = Sigmav[4,4]*v[4,.]; m = zeros(4,TT-t+1+100); m[.,1] = inv(eye(4)-R)*aa; i = 2; do while i <= TT-t+1+100; m[.,i] = aa+R*m[.,i-1]+v[.,i]; i = i+1; endo; m = m[.,101:TT-t+1+100]; ase = zeros(9,TT-t+1); ase[.,1] = inv(captheta[(TT-t)*dim1+1:(TT-t+1)*dim1,.])*A*sstar +caps[(TT-t)*dim1+1:(TT-t+1)*dim1,.] +capr[(TT-t)*dim1+1:(TT-t+1)*dim1,.] +capp[(TT-t)*dim1+1:(TT-t+1)*dim1,.] +capq[(TT-t)*dim1+1:(TT-t+1)*dim1,.]*m[.,1]; i = 2; do while i <= TT-t+1; ase[.,i] = inv(captheta[(TT-t+1-i)*dim1+1:(TT-t+2-i)*dim1,.])*A*ase[.,i-1] +caps[(TT-t+1-i)*dim1+1:(TT-t+2-i)*dim1,.] +capr[(TT-t+1-i)*dim1+1:(TT-t+2-i)*dim1,.] +capp[(TT-t+1-i)*dim1+1:(TT-t+2-i)*dim1,.] +capq[(TT-t+1-i)*dim1+1:(TT-t+2-i)*dim1,.]*m[.,i]; i = i+1; endo; oes = ase[1:3,.]'; @ Display Results @ format 9,4; " "; "The optimal expenditure shares are given by:"; "(The i-th expenditure share is in the i-th column, i = 1,2,3,"; "with each column running from t to T.)";?;?;oes;