' plot analytic and monte carlo standard errors in one graph
' need to pass results stored in a matrix using the 
' matbys= option of impulse command
' version 4 beta
' 1/31/2000 h
' last revised and checked 9/19/2000 h

' rps = name of matrix specified by matbys = option
' se1 = name of matrix of standard errors returned by matbys = option (with _se post-fix)
' se2 = name of matrix of standard errors returned by matbys = option (with _se post-fix)
' %gname = name for final combined graph

subroutine sub_irfgraph(matrix rsp, matrix se1, matrix se2, string %gname)

!hrz = @rows(rsp)
!k2 = @columns(rsp)

vector v
vector vbd
matrix rspse1 = se1*2
matrix rspse2 = se2*2

matrix(!hrz,5) tmp

' plot each graph separately 
for !c=1 to !k2
	' get point estimates
	v = @columnextract(rsp,!c)
	colplace(tmp,v,1)		
	' get bounds using first input
	vbd = v + @columnextract(rspse1,!c)
	colplace(tmp,vbd,2)		
	vbd = v - @columnextract(rspse1,!c)
	colplace(tmp,vbd,3)		
	' get bounds using second input
	vbd = v + @columnextract(rspse2,!c)
	colplace(tmp,vbd,4)		
	vbd = v - @columnextract(rspse2,!c)
	colplace(tmp,vbd,5)			
	freeze(tmp_graph{!c}) tmp.line
	tmp_graph{!c}.option linepat	' need to set linepat
	tmp_graph{!c}.elem(1) lcolor(blue) lpat(solid)
	tmp_graph{!c}.elem(2) lcolor(red) lpat(dash1)
	tmp_graph{!c}.elem(3) lcolor(red) lpat(dash1)
	tmp_graph{!c}.elem(4) lcolor(green) lpat(dash2)
	tmp_graph{!c}.elem(5) lcolor(green) lpat(dash2)
	tmp_graph{!c}.legend(off)
'	tmp_graph{!c}.legend -display
	%namelist = %namelist + "tmp_graph" + @str(!c) + " "
next

' combine graphs
freeze({%gname}) {%namelist}

delete v vbd rspse1 rspse2 {%namelist}

endsub

