helske / KFAS

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

Regression effect for level or slope #60

Closed Vera1996 closed 3 years ago

Vera1996 commented 3 years ago

Dear Helske,

is it possible to put the regression effect in the updating equation for the level \mu_t or slope \nu_t? The regression effect is now based on the observations when I use SSMregression. I want to know if de data that I use for the regression, affect the level or slope. So the growth or the growth of the growth. Now I have: model <- SSModel(covid_new[, 1:4] ~ SSMtrend(2, Q = list(diag(NA, 4, 4), diag(NA, 4, 4)), P1 = diag(100, 8, 8), P1inf = diag(0, 8, 8))

I hope you can help me!

helske commented 3 years ago

You can do it if you define your model using SSMcustom components i.e. you define the necessary system matrices manually, and then create corresponding updating function for fitSSM. Basically, you have to modify Z and T matrices according to your needs so that the previous state (regression coefficient) affects the new state (level and/or slope) via T.