# Internal functions of package robKalman for the classical Kalman filter

### Description

These functions are used internally by package robKalman

### Usage

1 2 3 4 5 6 7 |

### Arguments

`a` |
mean of the initial state |

`S` |
initial state covariance (see below) |

`Z` |
observation matrix (see below) |

`V` |
observation error covariance (see below) |

`F` |
innovation transition matrix (see below) |

`Q` |
innovation covariance (see below) |

`Delta` |
Covariance of |

`K` |
Kalman gain |

`S1` |
prediction error covariance |

`S0` |
filter error covariance |

`y` |
observation |

`x0` |
(classical Kalman)- filtered state |

`x1` |
(classical Kalman)- predicted state |

`...` |
not used here; for compatibility with signatures of other "step"-functions |

### Details

We work in the setup of the linear, Gaussian state space model (l-G-SSM)
with *p* dimensional states *x_t* and *q* dimensional observations *y_t*,
with **initial condition**

*x_0 ~ N_p(a,S),*

**state equation**

*x_t = F_t x_{t-1} + v_t, v_t ~ N_p(0,Q_t), t>=1,*

**observation equation**

*y_t = Z_t x_t + e_t, e_t ~ N_q(0,V_t), t>=1,*

and where all random variable *x_0*, *v_t*, *e_t* are independent.

For notation, let us formulate the classical Kalman filter in this context:

**(0) ininitial step**

*x_{0|0} = a*

*\code{ }* with error covariance

*S_{0|0} = Cov(x_0-x_{0|0}) = S*

**(1) prediction step**

*x_{t|t-1} = F_t x_{t-1|t-1}, t>=1*

*\code{ }* with error covariance

*S_{t|t-1} = Cov(x_t-x_{t|t-1}) = F_t S_{t-1|t-1} F_t' + Q_t*

**(2) correction step**

*x_{t|t} = x_{t|t-1} + K_t (y_t - Z_t x_{t|t-1}), t>=1*

*\code{ }* for Kalman Gain

*K_t = S_{t|t-1} Z_t' (Z_t S_{t|t-1} Z_t' + V_t )^-*

*\code{ }* with error covariance

*S_{t|t} =
Cov(x_t-x_{t|t}) = S_{t|t-1} - K_t Z_t S_{t|t-1}*

### Value

`.getDelta`

calculates the covariance of *Delta y_t*
for `S1 =`

*S_{t|t-1}*, `Z`

, `V`

as above

`.getKG`

calculates the Kalman Gain for `S1 =`

*S_{t|t-1}*, `Z`

, `V`

as above

`.getcorrCov`

calculates *S_{t|t}* for `S1 =`

*S_{t|t-1}*, `K =`

*K_t* and `Z`

as above

`.getpredCov`

calculates *S_{t|t-1}* for `S0 =`

*S_{t-1|t-1}*, `F`

, and `Q`

as above

`.cKinitstep`

calculates *x_{0|0}* for `a`

, `S`

as above

The return value is a list with components
`x0`

(the filtered value)
`S0`

(the filter error covariance)

`.cKpredstep`

calculates *x_{t|t-1}* for `x0 =`

*x_{t-1|t-1}*, `S0 =`

*S_{t-1|t-1}*, and `F`

, `Q`

The return value is a list with components
`x1`

(the predicted values),
`S1`

(the prediction error covariance),
`Ind`

(the indicators of clipped runs)

`.cKcorrstep`

calculates *x_{t|t}* for `x1 =`

*x_{t|t-1}*, `y =`

*y_{t}*,
`S1 =`

*S_{t|t-1}*, and `Z`

, `V`

The return value is a list with components
`x0`

(the filtered values), `K`

(the Kalman gain),
`S0`

(the filter error covariance),
`Delta`

(the covariance of *Delta y_t*),
`DeltaY`

(the observation residuals *Delta y_t*),
`Ind`

(the indicators of clipped runs)

### Author(s)

Peter Ruckdeschel Peter.Ruckdeschel@itwm.fraunhofer.de,

### See Also

`internalrLS`