On 11/05/2025 20:43, Theodoros Panagiotidis wrote:
Dear All,
You might find the attached script useful for teaching purposes.
It runs a simple CAPM with a January dummy variable and plots the
rolling coefficients and the rolling R^2.
Credit to Michalis Tsachakis for this.
Thanks, this is really very nice. Kudos to you!
I'm attaching a slightly revised version of the part of the script where
the plots are produced, that uses the "overlapping bands" syntax, which
is IMO a bit nicer.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucche...@univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
# Beta Confidence Intervals
bundles CIB = array(3)
bundle CIB[1] = _(center="b", width="width_b_01", style="fill", title="Beta Threshold")
CIB[1].color = 0x66cdcdcd
CIB[1].title = "99% Confidence Interval"
bundle CIB[2] = _(center="b", width="width_b_05", style="fill")
CIB[2].color = 0x66787878
CIB[2].title = "95% Confidence Interval"
bundle CIB[3] = _(center="b", width="width_b_10", style="fill")
CIB[3].color = 0x66343434
CIB[3].title = "90% Confidence Interval"
# Alpha Confidence Intervals
bundles CIA = array(3)
bundle CIA[1] = _(center="a", width="width_a_01", style="fill")
CIA[1].color = 0x66cdcdcd
CIA[1].title = "99% Confidence Interval"
bundle CIA[2] = _(center="a", width="width_a_05", style="fill")
CIA[2].color = 0x66787878
CIA[2].title = "95% Confidence Interval"
bundle CIA[3] = _(center="a", width="width_a_10", style="fill")
CIA[3].color = 0x66343434
CIA[3].title = "90% Confidence Interval"
# Jan Dummy Confidence Intervals
bundles CID = array(3)
bundle CID[1] = _(center="D", width="width_D_01", style="fill")
CID[1].color = 0x66cdcdcd
CID[1].title = "99% Confidence Interval"
bundle CID[2] = _(center="D", width="width_D_05", style="fill")
CID[2].color = 0x66787878
CID[2].title = "95% Confidence Interval"
bundle CID[3] = _(center="D", width="width_D_10", style="fill")
CID[3].color = 0x66343434
CID[3].title = "90% Confidence Interval"
gp_extra = sprintf("set title \"Beta Coefficient (99\% CI)\"; set xlabel \"Date\" ; set ylabel \"Coefficient Value\"; set grid ; set linetype 2 lw 3 ; set xrange[1987:2026]; set key inside; set key top; set key right; ")
# Beta:
gnuplot b beta_OLS --output=display --with-lines --time-series --bands=CIB { set yrange[-1:4]; @gp_extra }
# Alpha:
gnuplot a alpha_OLS --output=display --with-lines --time-series --bands=CIA { set yrange[-0.06:0.14]; @gp_extra}
# Jan Dummy:
gnuplot D Jan_OLS --output=display --with-lines --time-series --bands=CID { set yrange[-0.2:0.25]; @gp_extra }
_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-le...@gretlml.univpm.it
Website:
https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/