Formula: linearize f, h via Jacobians at the current state, then run the linear Kalman recursions on the linearisation.
Arguments
- y
Observation sequence (scalars).
- f
State transition x_t = f(x_{t-1}).
- h
Observation map y_t = h(x_t); returns a scalar.
- F
d x d Jacobian df/dx at the state.
- H
Length-d Jacobian dh/dx at the state.
- Q
d x d state noise covariance.
- R
Observation noise variance (> 0).
- x0
Initial state mean (default zeros).
- P0
Initial state covariance (default identity).
Details
predict x- = f(x), P- = F P F' + Q
gain S = H P- H' + R, K = P- H' / S
update x = x- + K (y - h(x-)), P = P- - K S K'
Scalar observations, d-dimensional state. f and h are
the (possibly nonlinear) transition and observation maps; F and
H are their Jacobians, supplied either as functions of the
state or as constant matrices, in which case the filter degenerates to
the plain linear Kalman filter.
References
Schmidt (1966), in Leondes (ed.), Advances in Control Systems 3:293-340; Jazwinski (1970), Stochastic Processes and Filtering Theory, Academic Press.
Examples
set.seed(1)
y <- matrix(cumsum(rnorm(20)), 20, 1)
EkfF(y, f = function(x) x, h = function(x) x, F = matrix(1), H = matrix(1),
Q = matrix(0.1), R = matrix(1))
#> $estimate
#> [1] 2.602284
#>
#> $state
#> [1] 2.602284
#>
#> $cov
#> [1] 0.2701574
#>
#> $loglik
#> [1] -30.26164
#>
#> $n
#> [1] 20
#>
#> $method
#> [1] "Extended Kalman filter"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
