helske / bssm

Bayesian Inference of State Space Models
42 stars 14 forks source link

trouble running filters / smoothers #24

Closed khusmann closed 3 years ago

khusmann commented 3 years ago

Hello, thanks again for your work.

I am having trouble running filters and smoothers. Example:

model <- bsm_ng(Seatbelts[, "VanKilled"], distribution = "poisson",
  sd_level = halfnormal(0.01, 1),
  sd_seasonal = halfnormal(0.01, 1),
  beta = normal(0, 0, 10),
  xreg = Seatbelts[, "law"])

filtered <- ekf(model)

gives error:

Error in ekf_nlg(t(model$y), model$Z, model$H, model$T, model$R, model$Z_gn,  : 
  Not compatible with requested type: [type=NULL; target=double].

Also occurs with ekf_smoother, ukf, etc.

Thank you!

helske commented 3 years ago

EKF and UKF are only supported for models of class ssm_nlg. For non-gaussian models, you can use particle filtering/smoothing (bootstrap_filter and particle_smoother) or approximate filtering/smoothing using kfilter/smoother.

khusmann commented 3 years ago

Awesome thanks!