Skip to contents

The backward half only: the filtered means and covariances are supplied, so the smoother costs one sweep and no re-filtering. The last smoothed state always equals the last filtered state, which is the identity that anchors the recursion.

Usage

Klmsmh(y, model, filtered, ridge = 1e-12)

Arguments

y

Observation matrix; only its length is used.

model

Named list with entry F.

filtered

Named list with state, cov, predicted, predicted_cov.

ridge

Ridge added to the predicted covariance before solving.

Value

List with estimate, smoothed, smoothed_cov, n, method.

Details

Formula: C = P_t F' P_{t+1|t}^{-1}; x_{t|n} = x_{t|t} + C (x_{t+1|n} - x_{t+1|t}).

References

Rauch, Tung and Striebel (1965), AIAA Journal 3(8):1445-1450. doi:10.2514/3.3166

Examples

set.seed(1)
y <- matrix(cumsum(rnorm(20)) + rnorm(20), 20, 1)
model <- list(F = matrix(1), H = matrix(1), Q = matrix(0.1), R = matrix(1),
              x0 = 0, P0 = matrix(1))
filtered <- Klmflt(y, model)
Klmsmh(y, model, filtered)
#> $estimate
#> [1] 0.03446971
#> 
#> $smoothed
#> $smoothed[[1]]
#> [1] 0.03446971
#> 
#> $smoothed[[2]]
#> [1] 0.01179793
#> 
#> $smoothed[[3]]
#> [1] -0.04362663
#> 
#> $smoothed[[4]]
#> [1] 0.01697356
#> 
#> $smoothed[[5]]
#> [1] 0.2465221
#> 
#> $smoothed[[6]]
#> [1] 0.3741053
#> 
#> $smoothed[[7]]
#> [1] 0.5621238
#> 
#> $smoothed[[8]]
#> [1] 0.7906033
#> 
#> $smoothed[[9]]
#> [1] 1.140055
#> 
#> $smoothed[[10]]
#> [1] 1.488585
#> 
#> $smoothed[[11]]
#> [1] 1.811977
#> 
#> $smoothed[[12]]
#> [1] 1.897318
#> 
#> $smoothed[[13]]
#> [1] 1.860304
#> 
#> $smoothed[[14]]
#> [1] 1.710313
#> 
#> $smoothed[[15]]
#> [1] 1.697961
#> 
#> $smoothed[[16]]
#> [1] 1.841848
#> 
#> $smoothed[[17]]
#> [1] 2.064648
#> 
#> $smoothed[[18]]
#> [1] 2.38819
#> 
#> $smoothed[[19]]
#> [1] 2.716947
#> 
#> $smoothed[[20]]
#> [1] 2.885739
#> 
#> 
#> $smoothed_cov
#> $smoothed_cov[[1]]
#>           [,1]
#> [1,] 0.2168904
#> 
#> $smoothed_cov[[2]]
#>           [,1]
#> [1,] 0.1885171
#> 
#> $smoothed_cov[[3]]
#>           [,1]
#> [1,] 0.1734042
#> 
#> $smoothed_cov[[4]]
#>           [,1]
#> [1,] 0.1653556
#> 
#> $smoothed_cov[[5]]
#>           [,1]
#> [1,] 0.1610714
#> 
#> $smoothed_cov[[6]]
#>           [,1]
#> [1,] 0.1587949
#> 
#> $smoothed_cov[[7]]
#>           [,1]
#> [1,] 0.1575929
#> 
#> $smoothed_cov[[8]]
#>           [,1]
#> [1,] 0.1569726
#> 
#> $smoothed_cov[[9]]
#>           [,1]
#> [1,] 0.1566795
#> 
#> $smoothed_cov[[10]]
#>           [,1]
#> [1,] 0.1565936
#> 
#> $smoothed_cov[[11]]
#>           [,1]
#> [1,] 0.1566795
#> 
#> $smoothed_cov[[12]]
#>           [,1]
#> [1,] 0.1569726
#> 
#> $smoothed_cov[[13]]
#>           [,1]
#> [1,] 0.1575929
#> 
#> $smoothed_cov[[14]]
#>           [,1]
#> [1,] 0.1587949
#> 
#> $smoothed_cov[[15]]
#>           [,1]
#> [1,] 0.1610714
#> 
#> $smoothed_cov[[16]]
#>           [,1]
#> [1,] 0.1653556
#> 
#> $smoothed_cov[[17]]
#>           [,1]
#> [1,] 0.1734042
#> 
#> $smoothed_cov[[18]]
#>           [,1]
#> [1,] 0.1885171
#> 
#> $smoothed_cov[[19]]
#>           [,1]
#> [1,] 0.2168904
#> 
#> $smoothed_cov[[20]]
#>           [,1]
#> [1,] 0.2701574
#> 
#> 
#> $n
#> [1] 20
#> 
#> $method
#> [1] "backward RTS pass over supplied filtered quantities, Rauch, Tung & Striebel (1965)"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"