Hi again Sven
perhaps I am being dim and most probably a pain! . Basically I am
interested determining the time varying trend parameter in a simple trend
relationship as in 36.4
[image: image.png]
where in the Script below y =Severnadj and x = Year. I created and
entered a new variable Year as the time trend time variable generated by
Gretl failed to work in an earlier run.
However MLE fails to recognize Year in the script entered. The datafile
loads correctly, mean of Severadj is correct.
Where am I going wrong.?
Script entered.
__________________________________________
function void at_each_step(bundle *b)
b.obsymat = transp(b.mX[b.t,])
end function
open WELSHEGGSCL.gdt --quiet
smpl 2002 2019
/* parameter initialization */
scalar b0 = mean(Severnadj)
scalar s_obs = 0.1
scalar s_state = 0.1
/* bundle setup */
bundle B = ksetup(Severnadj, 1, 1, 1)
matrix B.mX = {Year}
matrix B.depvar = {Severnadj}
B.timevar_call = "at_each_step"
B.diffuse = 1
/* ML estimation of intercept and the two variances */
mle LL = err ? NA : B.llt
B.obsy = B.depvar - b0
B.obsvar = s_obs^2
B.statevar = s_state^2
err = kfilter(&B)
params b0 s_obs s_state
end mle
/* display the smoothed time-varying slope */
ksmooth(&B)
series tvar_b1hat = B.state[,1]
series tvar_b1se = sqrt(B.stvar[,1])
gnuplot tvar_b1hat --time-series --with-lines --output=display \
--band=tvar_b1hat,tvar_b1se,1.96 --band-style=fill
___________________________________________________________
Final error messages from log :-
/* parameter initialization */
? scalar b0 = mean(Severnadj)
Generated scalar b0 = 9.84213
? scalar s_obs = 0.1
Generated scalar s_obs = 0.1
? scalar s_state = 0.1
Generated scalar s_state = 0.1
/* bundle setup */
? bundle B = ksetup(Severnadj, 1, 1, 1)
? matrix B.mX = {Year}
B.mX = {Year}
The symbol 'Year' is undefined
Error executing script: halting
matrix B.mX = {Year}
cheers
Brian
On Tue, 1 Dec 2020 at 17:10, Sven Schreiber <svetosch(a)gmx.net> wrote:
Am 01.12.2020 um 17:20 schrieb Brian Revell:
Hi Sven
many thanks for your prompt feedback. Where did you paste it in? In the
Model MLE option from the GUI -or under File -Script File-menu option?
The latter, yes, so basically in the built-in script editor. The MLE area
is meant for even lower-level access, without the predefined Kalman filter
objects.
know where to do this. The manual is not helpful in this respect.
In later parts of the guide it is pretty much assumed that people know the
scripting interface of gretl. However, at the beginning this is explained,
please see section 3.1.
(BTW, in my version of the guide the script listing is number 36.4 in ch.
36, I guess you have a slightly older version where some newer chapters do
not exist yet. But this shouldn't make a difference in this context.)
cheers
sven
_______________________________________________
Gretl-users mailing list -- gretl-users(a)gretlml.univpm.it
To unsubscribe send an email to gretl-users-leave(a)gretlml.univpm.it
Website:
https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/