Subject: XploRe: Learning Guide
See XploRe:

Quantlet: kalm03
Description: Applies the Kalman smoother on a time series.
Download: kalm03.xpl

Code:
;
  library("times")
  T = 100
  randomize(0)
  ex = normal(T)~(vec(1:T).*0)
  ey = normal(T).*2
  H = 1~0 
  F = #(0.5,1)~#(-0.3,0)
  x0 = #(0,0)
  ar2 = kemitor(T,x0,H,F,ey,ex)
;
  x0 = #(0,0)
  Sig = #(0,0)~#(0,0)
  H = 1~0
  F = #(0.5,1)~#(-0.3,0)
  Q = 4
  R = #(1,0)~#(0,0)
  filtered = kfilter(ar2,x0,Sig,H,F,Q,R)
; 
  smoothed = ksmoother(ar2,x0,Sig,H,F,Q,R)  
  smoot = vec(1:T)~smoothed
  smoot = setmask(smoot, "line", "blue", "medium")
  disp = createdisplay(1,1)
  show(disp,1,1, orig, smoot)
  setgopt(disp,1,1, "title", "AR(2) with noise - smoothed")

Subject: XploRe: Learning Guide
See XploRe:

© MD*Tech - Method and Data Technologies, generated on 6.6.2000 .