Dear all,
Below is a code to plot irf with confidence bounds
input is n x 3 matrix: 1-st col is irf and the rest are
confidence bounds
It is intended to plot 3 lines:
red solid for irf
and red dashed for bounds
I used Dell 630 latitude
On Ubuntu the plot is as intended to be, but
on the same notebook on XP plot uses
default color/style options: 3 lines are
solid red, blue , green
I know from gnuplot manuals that
dashing is monitor-dependent,
but I used the same pc.
I would be glad to know reports on
the results in other OS's and
suggestions, what it could be:
gretl, gnuplot, monitor, or drivers
< hansl
nulldata 1
function void irf_plot (matrix m "irf or irf + ci bounds",
bool cumul[0] "cumulative or simple(default) irf")
cm = cols(m)
if cm>1
xxx = strsplit(strsub(colname(m,2),"_"," "))
xx = xxx[1]
nr = rows(m)
s1 = seq(0,nr-1)'
m = m~s1
yname = "irf"
xname = "lag"
if cumul
title = "Cumulative irf with "~xx~" bootstrapped confidence
bounds"
else
title = "Irf with "~xx~" bootstrapped confidence bounds"
endif
if nr < 12
plot m
option single-yaxis
options with-lines fit=none
literal set termoption dashed
literal set style line 1 lt 1 lc 1
literal set style line 2 lt 2 lc 1
literal set style line 3 lt 2 lc 1
literal set nokey
literal set xtics 1
printf "set title \"%s\"", title
printf "set xlabel \"%s\"", xname
printf "set ylabel \"%s\"", yname
end plot --output=display
else
plot m
option single-yaxis
options with-lines fit=none
literal set termoption dashed
literal set style line 1 lt 1 lc 1
literal set style line 2 lt 2 lc 1
literal set style line 3 lt 2 lc 1
literal set nokey
printf "set title \"%s\"", title
printf "set xlabel \"%s\"", xname
printf "set ylabel \"%s\"", yname
end plot --output=display
endif
else
nr = rows(m)
s1 = seq(0,nr-1)'
m = m~s1
yname = "irf"
xname = "lag"
if cumul
title = "Cumulative impulse response"
else
title = "Impulse response"
endif
if nr < 12
plot m
options with-lines fit=none
literal set style line 1 lt 1 lc 1
literal set nokey
literal set xtics 1
printf "set title \"%s\"", title
printf "set xlabel \"%s\"", xname
printf "set ylabel \"%s\"", yname
end plot --output=display
else
plot m
options with-lines fit=none
literal set style line 1 lt 1 lc 1
literal set nokey
printf "set title \"%s\"", title
printf "set xlabel \"%s\"", xname
printf "set ylabel \"%s\"", yname
end plot --output=display
endif
endif
end function
irf10= {-0.18227, -0.23235, -0.13178;\
-0.15592, -0.20476, -0.10583;\
-0.058703, -0.079453, -0.035047;\
-0.026099, -0.047385, 0.0015223;\
-0.011117, -0.026593, 0.0054029;\
-0.0047856, -0.016134, 0.0019981;\
-0.0020547, -0.0096853, 0.00033121;\
-0.00088274, -0.0059829, 2.9214e-005;\
-0.00037919, -0.0036523, 6.2045e-006;\
-0.00016289, -0.0022186, 3.1268e-006;\
-6.9971e-005, -0.0013321, 1.5574e-006}
colnames(irf10,"irf 90%_lb 90%_rb")
irf_plot(irf10)
hansl>
Oleh