robKalman --- a package on Robust Kalman...

44
Robust Kalman Filtering Implementation proposal Demonstration robKalman — a package on Robust Kalman Filtering Peter Ruckdeschel 1 Bernhard Spangl 2 1 Fakult¨ at f¨ ur Mathematik und Physik [email protected] www.uni-bayreuth.de/departments/math/org/mathe7/RUCKDESCHEL 2 Universit¨ at f¨ ur Bodenkultur, Wien [email protected] www.rali.boku.ac.at/statedv.html 16.06.2006 Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Transcript of robKalman --- a package on Robust Kalman...

Page 1: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

robKalman — a package on Robust KalmanFiltering

Peter Ruckdeschel1 Bernhard Spangl2

1 Fakultat fur Mathematik und Physik

[email protected]/departments/math/org/mathe7/RUCKDESCHEL

2 Universitat fur Bodenkultur, Wien

[email protected]/statedv.html

16.06.2006

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 2: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Classical setup: Linear state space models (SSMs)

State equation:

Xt = FtXt−1 + vt

Observation equation:

Yt = ZtXt + εt

Ideal model assumption:

X0 ∼ Np(a0,Σ0), vt ∼ Np(0,Qt), εt ∼ Nq(0,Vt),

all independent

(preliminary ?) simplification: Hyper parameters Ft ,Zt ,Vt ,Qt

constant in t

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 3: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Classical setup: Linear state space models (SSMs)

State equation:

Xt = FtXt−1 + vt

Observation equation:

Yt = ZtXt + εt

Ideal model assumption:

X0 ∼ Np(a0,Σ0), vt ∼ Np(0,Qt), εt ∼ Nq(0,Vt),

all independent

(preliminary ?) simplification: Hyper parameters Ft ,Zt ,Vt ,Qt

constant in t

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 4: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Classical setup: Linear state space models (SSMs)

State equation:

Xt = FtXt−1 + vt

Observation equation:

Yt = ZtXt + εt

Ideal model assumption:

X0 ∼ Np(a0,Σ0), vt ∼ Np(0,Qt), εt ∼ Nq(0,Vt),

all independent

(preliminary ?) simplification: Hyper parameters Ft ,Zt ,Vt ,Qt

constant in t

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 5: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Classical setup: Linear state space models (SSMs)

State equation:

Xt = FtXt−1 + vt

Observation equation:

Yt = ZtXt + εt

Ideal model assumption:

X0 ∼ Np(a0,Σ0), vt ∼ Np(0,Qt), εt ∼ Nq(0,Vt),

all independent

(preliminary ?) simplification: Hyper parameters Ft ,Zt ,Vt ,Qt

constant in t

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 6: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Problem and classical solution

Problem: Reconststruction of Xt by means of Ys , s ≤ t

Criterium: MSE

general solution: EXt |(Ys)s≤t

Computational difficulties:=⇒ restriction to linear procedures

/ or: Gaussian assumptions

classical Kalman Filter

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 7: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Problem and classical solution

Problem: Reconststruction of Xt by means of Ys , s ≤ t

Criterium: MSE

general solution: EXt |(Ys)s≤t

Computational difficulties:=⇒ restriction to linear procedures

/ or: Gaussian assumptions

classical Kalman Filter

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 8: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Problem and classical solution

Problem: Reconststruction of Xt by means of Ys , s ≤ t

Criterium: MSE

general solution: EXt |(Ys)s≤t

Computational difficulties:=⇒ restriction to linear procedures

/ or: Gaussian assumptions

classical Kalman Filter

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 9: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Kalman filter

0 Initialization (t = 0):

X0|0 = a0, Σ0|0 = Σ0

1 Prediction (t ≥ 1):

Xt|t−1 = FXt−1|t−1, Cov(Xt|t−1) = Σt|t−1 = FΣt−1|t−1F′ + Q

2 Correction (t ≥ 1):

Xt|t = Xt|t−1 + Kt(Yt − ZXt|t−1)

Kt = Σt|t−1Z′(ZΣt|t−1Z

′ + V )−, (Kalman gain)

Cov(Xt|t) = Σt|t = Σt|t−1 − KtZΣt|t−1

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 10: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Kalman filter

0 Initialization (t = 0):

X0|0 = a0, Σ0|0 = Σ0

1 Prediction (t ≥ 1):

Xt|t−1 = FXt−1|t−1, Cov(Xt|t−1) = Σt|t−1 = FΣt−1|t−1F′ + Q

2 Correction (t ≥ 1):

Xt|t = Xt|t−1 + Kt(Yt − ZXt|t−1)

Kt = Σt|t−1Z′(ZΣt|t−1Z

′ + V )−, (Kalman gain)

Cov(Xt|t) = Σt|t = Σt|t−1 − KtZΣt|t−1

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 11: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Kalman filter

0 Initialization (t = 0):

X0|0 = a0, Σ0|0 = Σ0

1 Prediction (t ≥ 1):

Xt|t−1 = FXt−1|t−1, Cov(Xt|t−1) = Σt|t−1 = FΣt−1|t−1F′ + Q

2 Correction (t ≥ 1):

Xt|t = Xt|t−1 + Kt(Yt − ZXt|t−1)

Kt = Σt|t−1Z′(ZΣt|t−1Z

′ + V )−, (Kalman gain)

Cov(Xt|t) = Σt|t = Σt|t−1 − KtZΣt|t−1

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 12: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Types of outliers and robustification

IOs (system intrinsic): state equation is distorted— not considered here

AO/SOs (exogeneous): observations are distorted:

either error εt is affected (AO)or observations Yt are modified (SO)

a robustifications as to AO/SOs is to

retain recursivity (three-step approach)modify correction step bound influence of Yt

retain init./pred.step but with modified filter past Xt−1|t−1

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 13: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Types of outliers and robustification

IOs (system intrinsic): state equation is distorted— not considered here

AO/SOs (exogeneous): observations are distorted:

either error εt is affected (AO)or observations Yt are modified (SO)

a robustifications as to AO/SOs is to

retain recursivity (three-step approach)modify correction step bound influence of Yt

retain init./pred.step but with modified filter past Xt−1|t−1

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 14: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Types of outliers and robustification

IOs (system intrinsic): state equation is distorted— not considered here

AO/SOs (exogeneous): observations are distorted:

either error εt is affected (AO)or observations Yt are modified (SO)

a robustifications as to AO/SOs is to

retain recursivity (three-step approach)modify correction step bound influence of Yt

retain init./pred.step but with modified filter past Xt−1|t−1

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 15: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Considered approaches

Approximate conditional mean (ACM): [Martin(79)]

dim Yt = 1

particular model: Yt ∼ AR(p)

Xt = (Yt , . . . , Yt−p+1),hyper parameters Z = (1, 0, . . . , 0), V id = 0, F , Q unknown

estimation of F , Q by means of GM-Estimators

modified Corr.step: for suitable location influence curve ψ

Xt|t = Xt|t−1 + Σt|t−1Z′ψ(Yt − ZXt|t−1)

Σt|t = Σt|t−1 − Σt|t−1Z′ψ′(Yt − ZXt|t−1)ZΣt|t−1

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 16: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Considered approaches

Approximate conditional mean (ACM): [Martin(79)]

dim Yt = 1

particular model: Yt ∼ AR(p)

Xt = (Yt , . . . , Yt−p+1),hyper parameters Z = (1, 0, . . . , 0), V id = 0, F , Q unknown

estimation of F , Q by means of GM-Estimators

modified Corr.step: for suitable location influence curve ψ

Xt|t = Xt|t−1 + Σt|t−1Z′ψ(Yt − ZXt|t−1)

Σt|t = Σt|t−1 − Σt|t−1Z′ψ′(Yt − ZXt|t−1)ZΣt|t−1

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 17: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Considered approaches

Approximate conditional mean (ACM): [Martin(79)]

dim Yt = 1

particular model: Yt ∼ AR(p)

Xt = (Yt , . . . , Yt−p+1),hyper parameters Z = (1, 0, . . . , 0), V id = 0, F , Q unknown

estimation of F , Q by means of GM-Estimators

modified Corr.step: for suitable location influence curve ψ

Xt|t = Xt|t−1 + Σt|t−1Z′ψ(Yt − ZXt|t−1)

Σt|t = Σt|t−1 − Σt|t−1Z′ψ′(Yt − ZXt|t−1)ZΣt|t−1

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 18: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Considered approaches

Approximate conditional mean (ACM): [Martin(79)]

dim Yt = 1

particular model: Yt ∼ AR(p)

Xt = (Yt , . . . , Yt−p+1),hyper parameters Z = (1, 0, . . . , 0), V id = 0, F , Q unknown

estimation of F , Q by means of GM-Estimators

modified Corr.step: for suitable location influence curve ψ

Xt|t = Xt|t−1 + Σt|t−1Z′ψ(Yt − ZXt|t−1)

Σt|t = Σt|t−1 − Σt|t−1Z′ψ′(Yt − ZXt|t−1)ZΣt|t−1

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 19: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Considered approaches II

rLS filter: [P.R.(01)]

dim Xt , dim Yt arbitrary, finite

assumes hyper parameters a0, Z , V id, F , Q known

modified Corr.step:

Xt|t = Xt|t−1 + Hb

(Kt(Yt − ZXt|t−1)

)Hb(X ) = X min{1, b/|X |} for | · | Euclidean norm

optimality for SO’s in some sense

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 20: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Considered approaches II

rLS filter: [P.R.(01)]

dim Xt , dim Yt arbitrary, finite

assumes hyper parameters a0, Z , V id, F , Q known

modified Corr.step:

Xt|t = Xt|t−1 + Hb

(Kt(Yt − ZXt|t−1)

)Hb(X ) = X min{1, b/|X |} for | · | Euclidean norm

optimality for SO’s in some sense

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 21: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Classical setupRobustificationApproaches

Considered approaches II

rLS filter: [P.R.(01)]

dim Xt , dim Yt arbitrary, finite

assumes hyper parameters a0, Z , V id, F , Q known

modified Corr.step:

Xt|t = Xt|t−1 + Hb

(Kt(Yt − ZXt|t−1)

)Hb(X ) = X min{1, b/|X |} for | · | Euclidean norm

optimality for SO’s in some sense

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 22: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Concept and strategy

Goal: package robKalmanContents

Kalman filter: filter, Kalman gain, covariances

ACM-filter: filter, GM-estimator

rLS-filter: filter, calibration of clipping height

further recursive filters? general interface recursiveFilterwith arguments:

state space model (hyper parameters)functions for the init./pred./corr.step

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 23: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Concept and strategy

Goal: package robKalmanContents

Kalman filter: filter, Kalman gain, covariances

ACM-filter: filter, GM-estimator

rLS-filter: filter, calibration of clipping height

further recursive filters? general interface recursiveFilterwith arguments:

state space model (hyper parameters)functions for the init./pred./corr.step

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 24: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Concept and strategy

Goal: package robKalmanContents

Kalman filter: filter, Kalman gain, covariances

ACM-filter: filter, GM-estimator

rLS-filter: filter, calibration of clipping height

further recursive filters? general interface recursiveFilterwith arguments:

state space model (hyper parameters)functions for the init./pred./corr.step

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 25: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Concept and strategy II

Programming language

completely in S

perhaps some code in C (much) later

Use existing infrastructurefrom where to “borrow”:

univariate setting: KalmanLike (package stats);time series classes: ts, its, irts, zoo, zoo.reg, tframemultivariate setting: dse bundle by Paul Gilbert; perhaps zoo?

use for: graphics, diagnostics, management of date/time

Split user interface and “Kalman code”

internal functions: no S4-objectsuser interface: S4-objects

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 26: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Concept and strategy II

Programming language

completely in S

perhaps some code in C (much) later

Use existing infrastructurefrom where to “borrow”:

univariate setting: KalmanLike (package stats);time series classes: ts, its, irts, zoo, zoo.reg, tframemultivariate setting: dse bundle by Paul Gilbert; perhaps zoo?

use for: graphics, diagnostics, management of date/time

Split user interface and “Kalman code”

internal functions: no S4-objectsuser interface: S4-objects

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 27: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Concept and strategy II

Programming language

completely in S

perhaps some code in C (much) later

Use existing infrastructurefrom where to “borrow”:

univariate setting: KalmanLike (package stats);time series classes: ts, its, irts, zoo, zoo.reg, tframemultivariate setting: dse bundle by Paul Gilbert; perhaps zoo?

use for: graphics, diagnostics, management of date/time

Split user interface and “Kalman code”

internal functions: no S4-objectsuser interface: S4-objects

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 28: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Concept and strategy III

Use of S4Hierarchic Classes:

state space models (SSMs) (Hyper-Parameter, distributionalassumptions, outlier types)filter results (specific subclass of (multivariate) time series)control structures for filters (tuning parameters)

Methods:

filters (for different types of SSMs)accessor/replacement functionssimulate for SSMsfilter diagnostics: getClippings, conf.intervals ?tests?

constructors/generating funtions

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 29: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Concept and strategy III

Use of S4Hierarchic Classes:

state space models (SSMs) (Hyper-Parameter, distributionalassumptions, outlier types)filter results (specific subclass of (multivariate) time series)control structures for filters (tuning parameters)

Methods:

filters (for different types of SSMs)accessor/replacement functionssimulate for SSMsfilter diagnostics: getClippings, conf.intervals ?tests?

constructors/generating funtions

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 30: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Implementation so far: interfaces

preliminary, “S4-free” interfaces

Kalman filter (in our context) KalmanFilter

rLS (P.R.): rLSFilter— with routines for calibration at given

efficency in ideal modelcontamination radius

ACM (B.S.) ACMfilt, ACMfilter

with function arGM for AR-parameters by GM-estimatesvarious ψ-functions are available:Hampel (ACM-filter), Huber, Tukey (both GM-estimators)—see ?.psi

all: wrappers to recursiveFilter

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 31: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Implementation so far: interfaces

preliminary, “S4-free” interfaces

Kalman filter (in our context) KalmanFilter

rLS (P.R.): rLSFilter— with routines for calibration at given

efficency in ideal modelcontamination radius

ACM (B.S.) ACMfilt, ACMfilter

with function arGM for AR-parameters by GM-estimatesvarious ψ-functions are available:Hampel (ACM-filter), Huber, Tukey (both GM-estimators)—see ?.psi

all: wrappers to recursiveFilter

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 32: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Implementation so far: interfaces

preliminary, “S4-free” interfaces

Kalman filter (in our context) KalmanFilter

rLS (P.R.): rLSFilter— with routines for calibration at given

efficency in ideal modelcontamination radius

ACM (B.S.) ACMfilt, ACMfilter

with function arGM for AR-parameters by GM-estimatesvarious ψ-functions are available:Hampel (ACM-filter), Huber, Tukey (both GM-estimators)—see ?.psi

all: wrappers to recursiveFilter

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 33: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Implementation so far: package robKalman

package robKalman

routines gathered in package robKalman, version 0.1

documentationdemos

required packages — all available from CRAN: methods, graphics,startupmsg, dse1, dse2, MASS, limma, robustbase

availability: web-page setup under

http://www.uni-bayreuth.de/departments//math/org/mathe7/robKalman/

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 34: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Implementation so far: package robKalman

package robKalman

routines gathered in package robKalman, version 0.1

documentationdemos

required packages — all available from CRAN: methods, graphics,startupmsg, dse1, dse2, MASS, limma, robustbase

availability: web-page setup under

http://www.uni-bayreuth.de/departments//math/org/mathe7/robKalman/

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 35: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Implementation so far: package robKalman

package robKalman

routines gathered in package robKalman, version 0.1

documentationdemos

required packages — all available from CRAN: methods, graphics,startupmsg, dse1, dse2, MASS, limma, robustbase

availability: web-page setup under

http://www.uni-bayreuth.de/departments//math/org/mathe7/robKalman/

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 36: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Next steps

OOP

definition of S4 classes close contact to

RCore,Paul Gilbert,possibly Gabor Grothendiek and Achim Zeileis (zoo)

casting/conversion functions for various time series classes

User interface robfilter (?)

goal: four arguments: data, SSM, control-structure, filter typeshould cope with various definitions of SSMs, data in various timeseries classes,possibly simpler interfaces for ACM (Splus-compatibility) ACMfilt-like

Release schedule

wait for results of discussion as to class definitionguess: end of 2006

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 37: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Next steps

OOP

definition of S4 classes close contact to

RCore,Paul Gilbert,possibly Gabor Grothendiek and Achim Zeileis (zoo)

casting/conversion functions for various time series classes

User interface robfilter (?)

goal: four arguments: data, SSM, control-structure, filter typeshould cope with various definitions of SSMs, data in various timeseries classes,possibly simpler interfaces for ACM (Splus-compatibility) ACMfilt-like

Release schedule

wait for results of discussion as to class definitionguess: end of 2006

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 38: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

Concept / StrategyImplementation so farNext steps

Next steps

OOP

definition of S4 classes close contact to

RCore,Paul Gilbert,possibly Gabor Grothendiek and Achim Zeileis (zoo)

casting/conversion functions for various time series classes

User interface robfilter (?)

goal: four arguments: data, SSM, control-structure, filter typeshould cope with various definitions of SSMs, data in various timeseries classes,possibly simpler interfaces for ACM (Splus-compatibility) ACMfilt-like

Release schedule

wait for results of discussion as to class definitionguess: end of 2006

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 39: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

ACMfiltrLSFilter

Demonstration: ACMfilt

## gen e r a t i o n o f data from AO model :set . s eed (361)Eps ← as . t s ( rnorm (100 ) )a r2 ← ar ima . s im ( l i s t ( a r = c (1 , −0.9)) ,

100 , i nnov = Eps )Binom ← rbinom (100 , 1 , 0 . 1 )No i se ← rnorm (100 , sd = 10)y ← ar2 + as . t s (Binom∗Noise )

## de t e rm i n a t i o n o f GM−e s t ima t e sy . arGM ← arGM(y , 3)## ACM− f i l t e ry . ACMfi l t ← ACMfi l t ( y , y . arGM)

p lo t ( y )l i n e s ( y . ACMfi l t$ f i l t , co l=2)l i n e s ( ar2 , co l=” green ” )

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 40: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

ACMfiltrLSFilter

Time

y

0 20 40 60 80 100

−30

−20

−10

010

2030

green: ideal time series,black: AO contam. time

series,red: result ACM

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 41: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

ACMfiltrLSFilter

Demonstration: rLSFilter

## s p e c i f i c a t i o n o f SSM: ( p=2, q=1)a0 ← c (1 , 0 ) ; S0 ← matr ix (0 , 2 , 2)F ← matr ix ( c ( . 7 , 0 . 5 , 0 . 2 , 0 ) , 2 , 2)Q ← matr ix ( c (2 , 0 . 5 , 0 . 5 , 1 ) , 2 , 2)Z ← matr ix ( c (1 , −0.5) , 1 , 2)Vi ← 1 ;## time ho r i z on :TT← 50## AO−con tam ina t i onmc ← −20; Vc ← 0 . 1 ; r a c t ← 0 .1## f o r c a l i b r a t i o nr1← 0 . 1 ; e f f 1← 0 .9

#S imu l a t i o n : :X ← s imu l a t e S t a t e ( a , S0 , F , Q, TT)Yid ← s imu la teObs (X, Z , Vi , mc , Vc , r=0)Yre ← s imu la teObs (X, Z , Vi , mc , Vc , r a c t )

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 42: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

ACMfiltrLSFilter

Demonstration: rLSfilter II

### c a l i b r a t i o n b#l i m i t i n g S { t | t−1}SS ← l i m i t S (S , F , Q, Z , Vi )# by e f f i c i e n c y i n the i d e a l model(B1 ← r L S c a l i b r a t eB ( e f f=e f f 1 , S=SS , Z=Z , V=Vi ) )# by con tam ina t i on r a d i u s(B2 ← r L S c a l i b r a t eB ( r=r1 , S=SS , Z=Z , V=Vi ) )

### ev a l u a t i o n o f rLSr e r g 1 . i d ← r L S F i l t e r ( Yid , a , Ss , F , Q, Z , Vi , B1$b )r e r g 1 . r e ← r L S F i l t e r ( Yre , a , Ss , F , Q, Z , Vi , B1$b )r e r g 2 . i d ← r L S F i l t e r ( Yid , a , Ss , F , Q, Z , Vi , B2$b )r e r g 2 . r e ← r L S F i l t e r ( Yre , a , Ss , F , Q, Z , Vi , B2$b )

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 43: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

ACMfiltrLSFilter

0 10 20 30 40 50

−4−2

02

4

time

1. c

oord

inat

e of

sta

te

xx x x xxxx x x x x x x x xxx x

0 10 20 30 40 50

−20

12

time

2. c

oord

inat

e of

sta

te

xx x x xxxx x x x x x x x xxx x

0 10 20 30 40 50

−25

−15

−5

time

1. c

oord

inat

e of

sta

te xxxxx x xxxxx x xxx x x xx x x x xx xxxx

0 10 20 30 40 50

−10

−50

time

2. c

oord

inat

e of

sta

te

xxxxx x xxxxx x xxx x x xx x x x xx xxxx

ideal situation

black: real state,

red: class. Kalman filter

AO-contaminated situation

green: rLS filter (B1),

blue: rLS filter (B2)

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering

Page 44: robKalman --- a package on Robust Kalman Filteringrobkalman.r-forge.r-project.org/robKalman_slides_Wien.pdf · 2008-08-28 · Robust Kalman Filtering Implementation proposal Demonstration

Robust Kalman FilteringImplementation proposal

Demonstration

ACMfiltrLSFilter

Bibliography

Durbin, J. and Koopman, S. J.(2001):Time Series Analysis by State Space Methods.Oxford University Press.

Ruckdeschel, P. (2001):Ansatze zur Robustifizierung des Kalman Filters.Bayreuther Mathematische Schriften, Vol. 64.

R Development Core Team (2006):R:A language and environment for statistical computing.R Foundation for Statistical Computing, Vienna, Austria.http://www.R-project.org

Gilbert, P. (2005):Brief User’s Guide: Dynamic Systems Estimation (DSE).Available in the file doc/dse-guide.pdf distributed together with the R bundle dse, to be downloaded from

http://cran.r-project.org

Martin, D. (1979):Approximate conditional-mean type smoothers and interpolators.In Smoothing techniques for curve estimation.

Proc. Workshop Heidelberg 1979. Lect. Notes Math. 757, p. 117-143

Peter Ruckdeschel, Bernhard Spangl robKalman — a package on Robust Kalman Filtering