Closed gergelybat closed 2 years ago
beta2 is estimated similarly as the intercept and beta1, they are all part of the state vector, with variance of intercept and beta2 being constant. It is just I did not draw beta2 at the end as it is constant.
Thank you for the explanation. I really overcomplicated this.
In the reference manual (KFAS.pdf) under "More complex model" the following model is defined:
model <- SSModel(y ~ SSMregression(~ x1 + x2, Q = 0, R = matrix(c(1, 0), 2, 1)) + SSMarima(rep(0, 2), 0, Q = 0), H = 0)
Later on the coefficient forx2
(beta2) is not estimated. In order to make it work, I made the following changes (but I'm new to KFAS, this might be not the right approach):update_function
updated the corresponding parameter:model["a1", 3] <- pars[6]
fit <- fitSSM(model = model, inits = rep(0.1, 6), updatefn = update_function, method = "BFGS")