helske / KFAS

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

Regression in multivariate LLT model #50

Closed Vera1996 closed 4 years ago

Vera1996 commented 4 years ago

Dear,

My dataset consists 4 time series. I already fitted a Local Linear Trend on this data but now I want to add a regression to this model. The only problem is that I want to regress index_new[, 1] on covid_new[, 1], index_new[, 2] on covid_new[, 2] and so on. Is that possible using SSMregression?

helske commented 4 years ago

Yes it is possible by using the argument index in the SSMregression call (you need multiple calls for SSMregression in your formula then). Or you input the list of formulas for the SSMregression which should work as well:

x <- matrix(rnorm(30), 10, 3) y <- x + rnorm(30) model <- SSModel(y ~ SSMregression(list(~ X1,~ X2, ~ X3), data = as.data.frame(x))

Vera1996 commented 4 years ago

Thanks a lot! It works!!