Hi Sven
i HAVE ALSO BEEN LOOKING AT THE VARIABEL SLOPE COEFFICENT MODEL IN THE USER GUIDE IN WHICH THE EXOGENOUS VARIABLE IS TIME TIME IE IT WILL BE A VARIABLE TREND COEFFICIENT
THIS IS MY SCRIPT ADAPTED FROM THE USER MANUAL WHICH WORKS WELL
BUT I  ALSO WANT TO GRAPH THE ACTUAL DATA, TOGETHER WITH THE  SMOOTHED STATE VALUES  (AS INDICATED IN THE FINAL LINE) AND TO BE ABLE TO PRINT THE SMOOTHED SLOPE AND STATE VALUES OF THE DEP VAR.

function void at_each_step(bundle *b)
b.obsymat = transp(b.mX[b.t,])
end function
open SevernDeeEggs.gdt --quiet
smpl 1998 2019
/* parameter initialization */
scalar b0 = mean(SEVERN_EGGS_UNADJ)
scalar s_obs = 0.1
scalar s_state = 0.1
/* bundle setup */
bundle B = ksetup(SEVERN_EGGS_UNADJ, 1, 1, 1)
matrix B.mX = {time}
matrix B.depvar = {SEVERN_EGGS_UNADJ}
B.timevar_call = "at_each_step"
B.diffuse = 1
set bfgs_maxiter 5000
/* 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
gnuplot SEVERN_EGGS_UNADJ K SMOOTHED STATE VAR --time-series --with-lines --output=display

Any suggestions welcomed as what script I need to add to produce a printout of the estimated values .
cheers
Brian