% USA_Model2_46_2SLS.m % ************* % PART 3: M U L T I - E Q U A T I O N S M O D E L S % 13.3 Simulation Example % ============================================================== % Robert S. Pindyck & Daniel L. Rubinfeld % Econometric Models & Economic Forecast, 4/e % McGraw-Hill, 1998 % ISBN 0-07-050208-0 % % Data to accompany Econometric Models & Economic Forecast, 4/e % (c) Irwin/McGraw-Hill, 1998 % Disk 1 of 1 % ISBN 0-07-848043-4 % ============================================================== clear all; close all; clc; %data ulozena v textovem souboru USAMACRO.mat load USAMACRO; USAmacro = USAMACRO; t = USAmacro(5:end,1); % Ctvrtleti od 2Q1946-1Q1987 n = length(t); %endogeni promenne C = USAmacro(5:end,2); % Realna agregatni osobni potreba (v cenach roku 1982) [mld.] I = USAmacro(5:end,3); % Realne hrube domaci investice (v cenach roku 1982) [mld.] R = USAmacro(5:end,4); % Urokova sazba 3 mesicnich Treasury bill [% p.a.] Y = USAmacro(5:end,5); % Realny HDP (ocisten o exporty a importy; v cenach 1982) [mld.] dY = USAmacro(5:end,5)-USAmacro(4:end-1,5); %Y(t)-Y(t-1) %zpozdene endogenni promenne C_1 = USAmacro(4:end-1,2); %Zpozdene C(t-1) Y_1 = USAmacro(4:end-1,5); %... dY_1 = USAmacro(4:end-1,5)-USAmacro(3:end-2,5); %Y(t-1)-Y(t-2) R_4 = USAmacro(1:end-4,4); sumR_1 = USAmacro(4:end-1,4)+USAmacro(3:end-2,4); %R(t-1)+R(t-2) %exogenni promenne konst = ones(n,1); G = USAmacro(5:end,6); % Realne vladni vydaje (v cenach roku 1982) [mld.] dM = USAmacro(5:end,7)-USAmacro(4:end-1,7); % Zmena realne penezni zasoby (M1) [mld.] %odhad spotrebni funkce (13.14) C(t) = a1 + a2*Y(t) + a3*C(t-1) disp('*******************'); disp('*Spotrebni funkce*'); disp('*******************'); y = C; yendog = [Y]; %endogenni promenne v rovnici xexog = [konst C_1]; %predeterminovane promenne v rovnici %vsechny exogenni a zpozdenne endogenni promenne v systemu xall = [konst G dM C_1 Y_1 dY_1 R_4 sumR_1]; res2SLS_C = tsls(y,yendog,xexog,xall); vnames_C = strvcat('Spotreba','Y','konstanta','C_1'); prt_reg(res2SLS_C,vnames_C); %odhad investicni funkce (13.15) I(t) = b1 + b2*[Y(t-1)-Y(t-2)] + b3*Y(t) + b4*R(t-4) disp('*******************'); disp('*Investicni funkce*'); disp('*******************'); y = I; yendog = [Y]; xexog = [konst dY_1 R_4]; res2SLS_I = tsls(y,yendog,xexog,xall); vnames_I = strvcat('Investice','Y','konstanta','dY_1','R_4'); prt_reg(res2SLS_I,vnames_I); %odhad rovnice urokove miry (13.16) R(t) = c1 + c2*Y(t) + c3*[Y(t)-Y(t-1)] + c4*[M(t]-M(t-1)] + c5*[R(t-1)+R(t-2)] disp('**********************'); disp('*Rovnice urokove miry*'); disp('**********************'); y = R; yendog = [Y dY]; xexog = [konst dM sumR_1]; res2SLS_R = tsls(y,yendog,xexog,xall); vnames_R = strvcat('Ur. mira','Y','dY','konstanta','dM','sumR_1'); prt_reg(res2SLS_R,vnames_R);