1

I starting with the package dse in R, my goal is to estimate matrix G and Q from a state space model:

z(t) =Fz(t-1) + Gu(t) + Kw(t-1)

y(t) = Hz(t) + w(t)

u_t is my input vector that I call tx_cho and which is defined quarterly and y_t is my output vector that I call tx_act and which is also defined quarterly. I am using the package dse and the command dse::SS.

  # Define Matrix for Kalman filter

  f=array(c(0,0,0,1,1,0,0,1,1), c(3,3))
  h=array(c(1,0,0), c(1,3))
  g=array(c(-40,0,0), c(3, 1))
  q=array(c(2,0,0,0,0,2), c(3, 2))
  r=array(c(0), c(1,1))

  ss<-SS(F.=f, G=g, H=h, Q=q, R=r, names=list('tx_cho', 'tx_act'))

dim(tx_act) = 144,1 and so is tx_cho

The code runs correclty but then the summary(ss) does not seem have estimated the first value of matrix g (the one set at -40) and the two values of matrix q that are set at 2.

I am sorry if this is rather specific but I am stuck with this code forever and any help is very much welcome.

T.

Tochoka
  • 65
  • 5
  • This comes much much later, but what you have essentially done is to "define" a state-space model. You have not conducted any "estimation" procedure in the code you provided. I am not familiar with the `dse` package, but I used the `dlm` package instead. There should be another function for estimating the filtered distribution; one function in which you pass your actual data (which you have not used at all in the above code). – SavedByJESUS Jun 01 '20 at 08:43

0 Answers0