WOW. That's the only word that occurs to me.
I'm impressed with the "ketvars" package and the Giraitis et al (2020) model. If I knew about it before I could have saved a lot of trouble... Still need to learn more about the kernel parameter. I attached an image with a state space with kalman filter and the result of ketvars with a parameter of 0.1.

Many thanks
--
F.R.Costa





Oct 8, 2021, 12:43 by p002264@staff.univpm.it:
On Thu, 7 Oct 2021, F.R.Costa wrote:
Dear All,

I'm in trouble with state space models, as I find them difficult to implement. I was able to set up a few with just one time-variant unobservable variable but I'm not sure on what I'm doing when there are more. Let's say we depart from the example of the Phillips curve on pages 345-346 of Gretl manual, where the inflation rate (INFQ) depends on the unemployment rate (URX). In the example, the intercept is time-invariant and the coefficient for URX follows a random walk.

Let's expand the model such that there is a second independent variable Effective Exchange Rate (EER) explaining INFQ. Additionally, I want all three coefficients to follow an AR(1) process. The image attached shows this new model. How hard would that be to implement these changes on the script depicted on manual page 347 (as follows):

Speaking from personal experience, the state-space approach to time-varying parameter models is often difficult in practice because for large-ish models the identification issues become quite relevant and maximising the loglikelihood is quite difficult (although the EM algorithm may help).

There's an interesting non-parametric alternative that I find myself using quite often recently that was put forward by Giraitis, Kapetanios and several co-authors and is implemented in the gretl "ketvals" package.

I'm attaching an example script which shows the two alternatives on some simulated data, where the simulated coefficients are smoothed versions of AR(1) processes. As you can see, both approaches reconstruct the histories for both coefficients relatively well, but the non-parametric approach is much faster.




-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)

Università Politecnica delle Marche
(formerly known as Università di Ancona)

r.lucchetti@univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------