'*************************************************************************
'this program estimates the auxiliary system needed for simulation
'*************************************************************************

PAGESELECT TimeSeries 
SMPL !START !YEAR

'set the systems that have to be estimated 
%SYS_GT = "sys_style_gt"																											
SYSTEM {%SYS_GT}
FOR %IDC {%LIST}
	{%SYS_GT}.APPEND imf_spnd_ut{%IDC} = C(1)*imf_tot_ut{%IDC}*imf_eb{%IDC} + C(2)*imf_tot_ut{%IDC}*imf_tb{%IDC}	'unexpected spending on the total unexpected for EB and TB plans
NEXT

%SYS_GT1 = "sys_style_gt1"
SYSTEM {%SYS_GT1}
FOR %IDC {%LIST}
	{%SYS_GT1}.APPEND imf_spnd_att1{%IDC} = C(1)*imf_tot_ut{%IDC}*imf_eb{%IDC} + C(2)*imf_tot_ut{%IDC}*imf_tb{%IDC}	'announced (t+1) spending on the total unexpected for EB and TB plans
NEXT

%SYS_GT2 = "sys_style_gt2"
SYSTEM {%SYS_GT2}
FOR %IDC {%LIST}
	{%SYS_GT2}.APPEND imf_spnd_att2{%IDC} = C(1)*imf_tot_ut{%IDC}*imf_eb{%IDC} + C(2)*imf_tot_ut{%IDC}*imf_tb{%IDC}	'announced (t+2) spending on the total unexpected for EB and TB plans
NEXT

%SYS_TT = "sys_style_tt"
SYSTEM {%SYS_TT}
FOR %IDC {%LIST}
	{%SYS_TT}.APPEND imf_tax_ut{%IDC} = C(1)*imf_tot_ut{%IDC}*imf_eb{%IDC} + C(2)*imf_tot_ut{%IDC}*imf_tb{%IDC}		'unexpected (t+1) taxes on the total unexpected for EB and TB plans
NEXT

%SYS_TT1 = "sys_style_tt1"
SYSTEM {%SYS_TT1}
FOR %IDC {%LIST}
	{%SYS_TT1}.APPEND imf_tax_att1{%IDC} = C(1)*imf_tot_ut{%IDC}*imf_eb{%IDC} + C(2)*imf_tot_ut{%IDC}*imf_tb{%IDC}	'announced (t+1) taxes on the total unexpected for EB and TB plans
NEXT

%SYS_TT2 = "sys_style_tt2"
SYSTEM {%SYS_TT2}
FOR %IDC {%LIST}
	{%SYS_TT2}.APPEND imf_tax_att2{%IDC} = C(1)*imf_tot_ut{%IDC}*imf_eb{%IDC} + C(2)*imf_tot_ut{%IDC}*imf_tb{%IDC} 	'announced (t+2) taxes on the total unexpected for EB and TB plans
NEXT

'estimation
SMPL !START !YEAR																													
{%SYS_GT}.LS
{%SYS_GT1}.LS
{%SYS_GT2}.LS
{%SYS_TT}.LS
{%SYS_TT1}.LS
{%SYS_TT2}.LS

'coefficients' table
DELETE Table4*
TABLE(3,7) Table4
	Table4(1 ,2)	= "EB"
	Table4(1 ,3)	= "TB"
	Table4(2, 1)	= "phi0"
	Table4(3, 1)	= "se"
	Table4(4, 1)	= "phi1"
	Table4(5, 1)	= "se"
	Table4(6, 1)	= "phi2"
	Table4(7, 1)	= "se"
	Table4(8, 1)	= "theta0"
	Table4(9, 1)	= "se"
	Table4(10, 1)	= "theta1"
	Table4(11, 1)	= "se"
	Table4(12, 1)	= "theta2"
	Table4(13, 1)	= "se"
!i=2
FOR !k=2 TO 3
	Table4(!i, !k) = @ROUND(10000*sys_style_tt.@COEFS(!k-1))/10000
	Table4(!i+1, !k) = @ROUND(10000*sys_style_tt.@STDERRS(!k-1))/10000
	Table4(!i+2, !k) = @ROUND(10000*sys_style_tt1.@COEFS(!k-1))/10000
	Table4(!i+3, !k) = @ROUND(10000*sys_style_tt1.@STDERRS(!k-1))/10000
	Table4(!i+4, !k) = @ROUND(10000*sys_style_tt2.@COEFS(!k-1))/10000
	Table4(!i+5, !k) = @ROUND(10000*sys_style_tt2.@STDERRS(!k-1))/10000
	Table4(!i+6, !k) = @ROUND(10000*sys_style_gt.@COEFS(!k-1))/10000
	Table4(!i+7, !k) = @ROUND(10000*sys_style_gt.@STDERRS(!k-1))/10000
	Table4(!i+8, !k) = @ROUND(10000*sys_style_gt1.@COEFS(!k-1))/10000
	Table4(!i+9, !k) = @ROUND(10000*sys_style_gt1.@STDERRS(!k-1))/10000
	Table4(!i+10, !k) = @ROUND(10000*sys_style_gt2.@COEFS(!k-1))/10000
	Table4(!i+11, !k) = @ROUND(10000*sys_style_gt2.@STDERRS(!k-1))/10000
NEXT
Table4.SETFORMAT(B) f.4
Table4.SETFORMAT(C) f.4



