'********************************************************************************************
'this program collects responses of output, taxes, spending and F(s) and plots them
'********************************************************************************************
SMPL !START !YEAR 
PAGESELECT TimeSeries
%MODEL5 = "SD2"	
%MODEL0_MP = "SPND_D_C SPND_U_C TAX_D_C TAX_U_C"  
%MODEL0_NOMP = "SPND_D SPND_U TAX_D TAX_U"  
%MODEL0_MP_UP = "SPND_U_C TAX_U_C"  
%MODEL0_MP_DOWN = "SPND_D_C TAX_D_C"  
%MODEL0_NOMP_UP = "SPND_U TAX_U"  
%MODEL0_NOMP_DOWN = "SPND_D TAX_D"  
%MP_TYPE="mp nomp" 

FOR %MP {%MP_TYPE}
	'collect responses of output, taxes and spending
	FOR %VAR {%VARS}
			FOR %IDC {%LIST}
					!j=1
					MATRIX(!HORZ,12) rsp_{%MP}_{%VAR}_{%MODEL5}_{%IDC}
					FOR %MOD {%MODEL0_{%MP}}
							FOR !i=1 TO 3	
									FOR !k=1 to !HORZ
										rsp_{%MP}_{%VAR}_{%MODEL5}_{%IDC}(!k,!j) = rsp_{%VAR}_{%MOD}_{%IDC}(!k,!i)
									NEXT
								!j=!j+1
							NEXT
					NEXT
			NEXT
	NEXT
	'fs up matrix
	FOR %IDC {%LIST}
			!j=1
			MATRIX(!HORZ,8) rsp_{%MP}_fsup_{%MODEL5}_{%IDC}
			FOR %MOD {%MODEL0_{%MP}_UP}
				FOR !i=1 TO 4
					FOR !k=1 to !HORZ
						rsp_{%MP}_fsup_{%MODEL5}_{%IDC}(!k,!j) = rsp_fs_{%MOD}_{%IDC}(!k,!i)
					NEXT
					!j=!j+1
				NEXT
			NEXT
	NEXT
	'fs down matrix
	FOR %IDC {%LIST}
			!j=1
			MATRIX(!HORZ,8) rsp_{%MP}_fsdown_{%MODEL5}_{%IDC}
			FOR %MOD {%MODEL0_{%MP}_DOWN}
				FOR !i=1 TO 4
					FOR !k=1 to !HORZ
						rsp_{%MP}_fsdown_{%MODEL5}_{%IDC}(!k,!j) = rsp_fs_{%MOD}_{%IDC}(!k,!i)
					NEXT
					!j=!j+1
				NEXT
			NEXT
	NEXT
	'fs deviation
	FOR %IDC {%LIST}
			!j=1
			MATRIX(!HORZ,12) rsp_{%MP}_fsd_{%MODEL5}_{%IDC}
			FOR %MOD {%MODEL0_{%MP}}
				FOR !i=1 TO 3	
					FOR !k=1 to !HORZ
						rsp_{%MP}_fsd_{%MODEL5}_{%IDC}(!k,!j) = rsp_fsd_{%MOD}_{%IDC}(!k,!i)
					NEXT
					!j=!j+1
				NEXT
			NEXT
	NEXT

	'graph output taxes and spending
	FOR %IDC {%LIST}
		%FIG = "FIG1"
			FOR %NAME {%VARS} 
				DELETE FIG_{%MP}_{%NAME}_{%IDC}*
				FREEZE({%FIG}_{%MP}_{%NAME}_{%IDC}) rsp_{%MP}_{%NAME}_{%MODEL5}_{%IDC}.LINE
				{%FIG}_{%MP}_{%NAME}_{%IDC}.OPTION linepat 
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(1) lcolor(102,178,255) lpat(dash7) lwidth(0.25)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(3) lcolor(102,178,255) lpat(dash7) lwidth(0.25)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(2) lcolor(102,178,255) lpat(solid) lwidth(2) sym(circle) symbolsize(4xl)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(4) lcolor(blue) lpat(dash7) lwidth(0.25)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(6) lcolor(blue) lpat(dash7) lwidth(0.25)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(5) lcolor(blue) lpat(solid) lwidth(2) sym(circle) symbolsize(4xl)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(7) lcolor(255,153,153) lpat(dash7) lwidth(0.25)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(9) lcolor(255,153,153) lpat(dash7) lwidth(0.25)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(8) lcolor(255,153,153) lpat(solid) lwidth(2) sym(circle) symbolsize(4xl)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(10) lcolor(red) lpat(dash7) lwidth(0.25)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(12) lcolor(red) lpat(dash7) lwidth(0.25)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(11) lcolor(red) lpat(solid) lwidth(2) sym(circle) symbolsize(4xl)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.AXIS(l) grid zeroline  range(-8,10)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.LEGEND(off,inbox,b)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.SETOBSLABEL(blank) "0" "1" "2" "3" "4" "5"
				{%FIG}_{%MP}_{%NAME}_{%IDC}.OPTIONS backfade(none) backcolor(white)
				{%FIG}_{%MP}_{%NAME}_{%IDC}.AXIS overlap	
				RENAME {%FIG}_{%MP}_{%NAME}_{%IDC} fig_{%MP}_{%NAME}_{%IDC}_{%MODEL5}
			NEXT
	NEXT
	'graph fs up
	FOR %IDC {%LIST}
		%FIG = "FIG2"
		%NAME="fsup"
		DELETE FIG_{%MP}_{%NAME}_{%IDC}*
		FREEZE({%FIG}_{%MP}_{%NAME}_{%IDC}) rsp_{%MP}_fsup_{%MODEL5}_{%IDC}.LINE
		{%FIG}_{%MP}_{%NAME}_{%IDC}.OPTION linepat 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(1) lcolor(black) lpat(solid) lwidth(1) 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(3) lcolor(blue) lpat(solid) lwidth(1)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(2) lcolor(blue) lpat(dash7) lwidth(0.25) 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(4) lcolor(blue) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(7) lcolor(red) lpat(solid) lwidth(1)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(6) lcolor(red) lpat(dash7) lwidth(0.25) 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(8) lcolor(red) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(5) lcolor(black) lpat(solid) lwidth(1) 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.AXIS(l) grid zeroline range(-0.16,0.35)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.LEGEND(off,inbox,b)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.SETOBSLABEL(blank)  "0" "1" "2" "3" "4" "5"
		{%FIG}_{%MP}_{%NAME}_{%IDC}.OPTIONS backfade(none) backcolor(white)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.AXIS overlap	
		RENAME {%FIG}_{%MP}_{%NAME}_{%IDC} fig_{%MP}_{%NAME}_{%IDC}_{%MODEL5}
	NEXT
	'graph fs down
	FOR %IDC {%LIST}
		%FIG = "FIG2"
		%NAME="fsdown"
		DELETE FIG_{%MP}_{%NAME}_{%IDC}*
		FREEZE({%FIG}_{%MP}_{%NAME}_{%IDC}) rsp_{%MP}_fsdown_{%MODEL5}_{%IDC}.LINE
		{%FIG}_{%MP}_{%NAME}_{%IDC}.OPTION linepat 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(1) lcolor(black) lpat(solid) lwidth(1) 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(3) lcolor(102,178,255) lpat(solid) lwidth(1)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(2) lcolor(102,178,255) lpat(dash7) lwidth(0.25) 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(4) lcolor(102,178,255) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(7) lcolor(255,153,153) lpat(solid) lwidth(1)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(6) lcolor(255,153,153) lpat(dash7) lwidth(0.25) 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(8) lcolor(255,153,153) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(5) lcolor(black) lpat(solid) lwidth(1) 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.AXIS(l) grid zeroline range(-0.16,0.35)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.LEGEND(off,inbox,b)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.SETOBSLABEL(blank)  "0" "1" "2" "3" "4" "5"
		{%FIG}_{%MP}_{%NAME}_{%IDC}.OPTIONS backfade(none) backcolor(white)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.AXIS overlap		
		RENAME {%FIG}_{%MP}_{%NAME}_{%IDC} fig_{%MP}_{%NAME}_{%IDC}_{%MODEL5}
	NEXT
	'graph fs deviaiton
	FOR %IDC {%LIST}
		%FIG = "FIG2"
		%NAME="fsd"
		DELETE FIG_{%MP}_{%NAME}_{%IDC}*
		FREEZE({%FIG}_{%MP}_{%NAME}_{%IDC}) rsp_{%MP}_fsd_{%MODEL5}_{%IDC}.LINE
		{%FIG}_{%MP}_{%NAME}_{%IDC}.OPTION linepat 
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(1) lcolor(102,178,255) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(3) lcolor(102,178,255) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(2) lcolor(102,178,255) lpat(solid) lwidth(2) sym(circle) symbolsize(4xl)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(4) lcolor(blue) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(6) lcolor(blue) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(5) lcolor(blue) lpat(solid) lwidth(2) sym(circle) symbolsize(4xl)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(7) lcolor(255,153,153) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(9) lcolor(255,153,153) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(8) lcolor(255,153,153) lpat(solid) lwidth(2) sym(circle) symbolsize(4xl)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(10) lcolor(red) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(12) lcolor(red) lpat(dash7) lwidth(0.25)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.ELEM(11) lcolor(red) lpat(solid) lwidth(2) sym(circle) symbolsize(4xl)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.AXIS(l) grid zeroline  range(-8,10)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.LEGEND(off,inbox,b)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.SETOBSLABEL(blank) "0" "1" "2" "3" "4" "5"
		{%FIG}_{%MP}_{%NAME}_{%IDC}.OPTIONS backfade(none) backcolor(white)
		{%FIG}_{%MP}_{%NAME}_{%IDC}.AXIS overlap	
		RENAME {%FIG}_{%MP}_{%NAME}_{%IDC} fig_{%MP}_{%NAME}_{%IDC}_{%MODEL5}
	NEXT
NEXT


