Welcome | State space notation | Functions | > kalman.smoother |
Last update Apr 29, 2003 |
DESCRIPTION:Kalman smoother for Gaussian observations assuming linear Gaussian latent process. The specific model is
USAGE:kalman.smoother(ssm)
REQUIRED ARGUMENTS:
OPTIONAL ARGUMENTS:The following attributes of the ssm object might be needed:
VALUE:Returns an object of class ssm with the same attributes as the object in the call, but with attribute smoothed updated with:
SIDE EFFECTS:None
DETAILS:This is the standard Kalman smoother.
REFERENCES:Durbin & Koopman, (2002), Time Series Analysis by State Space Models, Oxford Statistical Science Series.Fahrmeir & Tutz, (1994), Multivariate Statistical Modelling Based on Generalized Linear Models, Springer Series in Statistics. Klein, (2003), State Space Models for Exponential Family Data, Ph.D. Thesis, Department of Statistics, University of Southern Denmark. West & Harrison, (1997), Bayesian Forecasting and Dynamic Models, Springer Series in Statistics. EXAMPLES:# local level state space model ss <- ssm( Ft = function(i, x, phi) {matrix(1,1,1)}, Gt = function(i, x, phi) {matrix(1,1,1)}, Vt = function(i, x, phi) {matrix(80,1,1)}, Wt = function(i, x, phi) {matrix(10,1,1)}, m0 = c(20), C0 = matrix(50,1,1)) # simulate latent process and observations ss <- simulate.ssm(ss) # set prior ss$m0 <- c(0) # apply Kalman filter and Kalman smoother ss <- kalman.filter(ss) ss <- kalman.smoother(ss) # plot like Figure 1.8, upper panel par(mfrow=c(2,1)) plot(ss$smoothed$m.tilde, ylim=c(-30,60), type="l", lty=3) lines(ss$smoothed$m.tilde+2*sqrt(ss$smoothed$C.tilde[1,1,]),lty=2) lines(ss$smoothed$m.tilde-2*sqrt(ss$smoothed$C.tilde[1,1,]),lty=2) lines(ss$simulated$theta,lty=1) # Exchange evolution and observation variances ss$Vt <- function(i, x, phi) matrix(10,1,1) ss$Wt <- function(i, x, phi) matrix(80,1,1) # apply Kalman filter and Kalman smoother ss <- kalman.filter(ss) ss <- kalman.smoother(ss) # plot like Figure 1.8, lower panel plot(ss$smoothed$m.tilde, ylim=c(-30,60), type="l", lty=3) lines(ss$smoothed$m.tilde+2*sqrt(ss$smoothed$C.tilde[1,1,]),lty=2) lines(ss$smoothed$m.tilde-2*sqrt(ss$smoothed$C.tilde[1,1,]),lty=2) lines(ss$simulated$theta,lty=1) |