1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
clear
set verbose off
include KFgui.gfn
set seed 280921
nulldata 256
setobs 1 1 --special
# example 1: random walk plus noise
COMPARE = 0
series m = cum(normal() * 0.25)
series y = m + normal()
Z = {1}
T = {1}
do_smooth = 1
paramtype = 2
b = KFgui(y, Z, T, 1, paramtype, 1, do_smooth)
series mhat = b.state
gnuplot m mhat --time-series --with-lines --output=display
if COMPARE
# compare with StrucTiSM
include StrucTiSM.gfn
mod = STSM_setup(y, 1, 1, 0)
STSM_estimate(&mod)
list C = STSM_components(mod)
ols mhat const y_level
endif
|