helske / KFAS

KFAS: R Package for Exponential Family State Space Models
64 stars 17 forks source link

Exact diffuse intialisation #69

Closed AdamElderfield closed 1 year ago

AdamElderfield commented 3 years ago

Hi,

This is question rather than an issue. I want to understand exact diffuse intialisation better, could you please point me to code that handles this for KFAS?

helske commented 3 years ago

The codes are in the Fortran files src/filter1step.f90, and the actual equations used can be found in the appendix of the KFAS paper at JSS: https://www.jstatsoft.org/article/view/v078i10

AdamElderfield commented 3 years ago

Thank you. How does KFAS handle initialization with a mix of stationary and non-stationary states? Say for example, a trend cycle decomposition? Are the steady state values solved for the stationary part?

helske commented 3 years ago

Stationary distribution in the case of ARIMA processes is solved within the SSMarima function based on the input, otherwise, an arbitrary combination of diffuse and non-diffuse initialization works by checking the corresponding (diagonal) elements of P and Pinf during the filtering. The handling follows the article above with further details in Durbin & Koopman book (and the corresponding articles by them).