KalmanFilter_back {EcoEnsemble} | R Documentation |
Finds the most likely path through a dynamical linear model.
KalmanFilter_back(rhos, dee, R, Q, C, P, xhat, Time, y, obs)
rhos |
A |
dee |
A |
R |
A |
Q |
A |
C |
A a |
P |
A |
xhat |
A |
Time |
A numeric The length of time of the dynamical linear model. |
y |
A |
obs |
A |
For the model with the evolution process
x_{t+1}\sim{}N(\rho{}\cdot{}x_{t},Q)
and observation process
y_{t}\sim{}N(\rho{}(x_{t} + \delta),diag(R))
.
Using the sequential Kalman filter, the function gives the mostly path of x_{t}
for all t
.
A matrix
with dimensions nrow(time)
and length(xhat)
representing the most likely values of the latent variables.
Chui, C.K. & Chen, G. (2009) Kalman Filtering with Real-Time Applications. Springer, Berlin, Heidelberg, Fourth Edtion.
Kalman, R. E. (1960) A new approach to linear filtering and prediction problems. Trans. ASME, J. Basic Eng., 82, pp. 35-45.
fit <- fit_ensemble_model(observations = list(SSB_obs, Sigma_obs),
simulators = list(list(SSB_ewe, Sigma_ewe, "EwE"),
list(SSB_fs, Sigma_fs, "FishSUMS"),
list(SSB_lm, Sigma_lm, "LeMans"),
list(SSB_miz, Sigma_miz, "Mizer")),
priors = EnsemblePrior(4,
ind_st_params = IndSTPrior(parametrisation_form = "lkj",
var_params= list(1,1), cor_params = 10, AR_params = c(2, 2))),
full_sample = FALSE) #Only optimise in this case
transformed_data <- get_transformed_data(fit)
ex.fit <- fit@point_estimate$par
params <- get_parameters(ex.fit)
ret <- KalmanFilter_back(params$AR_params, params$lt_discrepancies,
transformed_data$all_eigenvalues_cov,params$SIGMA,
transformed_data$bigM, params$SIGMA_init, params$x_hat,
fit@ensemble_data@stan_input$time,transformed_data$new_data,
transformed_data$observation_available)