For Kalman Filter Durbin/Koopman give at p67 equations  4.13:
  
     v = y - Z a,  F = Z P Z' + H,  K = T P Z' / F + H,
     a[t+1] = T a + K v,  P[t+1] = T P L' + R Q R'
  
  for P1 = 0, Q=0,  T=Z=R=1 that reduces to:
  
     v = y - a,  F = H,  K = H,  a[t+1] = a + K v,  P[t+1] = 0
     (equivalent to exponential moving average, Durbin/Koopman p49)
  
  for vector y = c(1,2,3,4,5), H = 0.66 manual calculations
  using the equations above give a = c(1,1.66,2.55,3.51,4.50).
  KalmanRun with these parameters gives res$states = (1,1,1,1,1).
  
  Looking into the code of arima.c we have at line 109 an equivalent of
      a[t+1] = anew + Pnew * resid0 / gain
  where gain = mod$h = H (by line 97), resid0 = y-a = v (by lines 94-96)
  Since Pnew = 0, then a[t+1] = a, which explains why the computation
  returns res$states = c(1,1,1,1,1).
  
  The help file says "'states', the contemporaneous state
estimates",
  which I assumed to mean 'a' in the equations above. But that
  assumption does not agree with the numerical results. It also
  does not agree with the coding(?) as  a[t+1] = a + K v  differs
  substantially from   a[t+1] = anew + Pnew * resid0 / gain.
  
  So, what does 'states' contain? Where did I go wrong?
  
   
		
---------------------------------
	[[alternative HTML version deleted]]