Native local-level (random-walk-plus-noise) model: the observation
and state variances are estimated by maximum likelihood on the
prediction-error decomposition, then the series is filtered and
smoothed (Rauch-Tung-Striebel). Equivalent to the
dlm::dlmModPoly(1) + dlmMLE + dlmFilter +
dlmSmooth pipeline it replaces, cross-validated in tests.
Value
Named list with filtered_state, filtered_state_variance,
smoothed_state, loglik, Q, R, n, method.
Examples
morie_state_space_model(x = rnorm(50))
#> $filtered_state
#> [1] 0.0634740963 -0.0842516719 0.1555189889 0.5253003072 0.0585747344
#> [6] 0.0131646203 0.0213362662 0.0873826920 0.0002486645 0.0392803930
#> [11] 0.0703831998 0.0634868688 0.0490313409 0.1502965781 0.1852053866
#> [16] 0.2959066362 0.2626744191 0.1789396375 0.1486952893 0.1461303573
#> [21] 0.1278200071 0.1032905509 0.0302249488 -0.0042542672 -0.0479335756
#> [26] -0.0342319451 -0.0201939026 0.0355147524 0.0229275444 0.0537762793
#> [31] 0.0365816982 -0.0119017066 0.0016267329 -0.0137016075 -0.0371546852
#> [36] -0.0571406073 -0.0261502138 0.0159177811 0.0413394997 0.0334770587
#> [41] 0.0007171255 0.0059994307 0.0317537181 0.0500637439 0.0559404813
#> [46] 0.0595552138 0.0403388055 0.0487443637 0.0488882974 0.0492699795
#>
#> $filtered_state_variance
#> [1] 0.76664039 0.38332021 0.25554681 0.19166011 0.15332809 0.12777341
#> [7] 0.10952006 0.09583006 0.08518227 0.07666405 0.06969459 0.06388671
#> [13] 0.05897234 0.05476003 0.05110937 0.04791503 0.04509650 0.04259114
#> [19] 0.04034950 0.03833203 0.03650669 0.03484730 0.03333220 0.03194336
#> [25] 0.03066562 0.02948618 0.02839410 0.02738002 0.02643588 0.02555469
#> [31] 0.02473034 0.02395752 0.02323154 0.02254826 0.02190402 0.02129558
#> [37] 0.02072002 0.02017476 0.01965746 0.01916602 0.01869856 0.01825335
#> [43] 0.01782886 0.01742366 0.01703646 0.01666611 0.01631151 0.01597169
#> [49] 0.01564573 0.01533282
#>
#> $smoothed_state
#> [1] 0.04926997 0.04926997 0.04926997 0.04926997 0.04926997 0.04926997
#> [7] 0.04926997 0.04926997 0.04926997 0.04926997 0.04926997 0.04926997
#> [13] 0.04926997 0.04926997 0.04926997 0.04926997 0.04926996 0.04926996
#> [19] 0.04926996 0.04926996 0.04926995 0.04926995 0.04926995 0.04926995
#> [25] 0.04926995 0.04926995 0.04926996 0.04926996 0.04926996 0.04926996
#> [31] 0.04926996 0.04926996 0.04926996 0.04926996 0.04926996 0.04926997
#> [37] 0.04926997 0.04926997 0.04926997 0.04926998 0.04926998 0.04926998
#> [43] 0.04926998 0.04926998 0.04926998 0.04926998 0.04926998 0.04926998
#> [49] 0.04926998 0.04926998
#>
#> $loglik
#> [1] -64.9765
#>
#> $Q
#> [1] 7.032028e-10
#>
#> $R
#> [1] 0.7666405
#>
#> $n
#> [1] 50
#>
#> $method
#> [1] "Local-level Kalman filter+smoother, native MLE"
#>
