Learn R Programming

KFAS (version 1.3.7)

mvInnovations: Multivariate Innovations

Description

Function mvInnovations computes the multivariate versions of one step-ahead prediction errors and their variances using the output of KFS.

Usage

mvInnovations(x)

Arguments

x

Object of class KFS.

Value

v

Multivariate prediction errors \(v_{t} = y_{t} - Z_{t}a_{t} \)

F

Prediction error variances \(Var(v_{t})\).

Finf

Diffuse part of \(F_t\).

Examples

Run this code
# NOT RUN {
# Compute the filtered estimates based on the KFS output

filtered <- function(x) {
  innov <- mvInnovations(x)
  att <- window(x$a, end = end(x$a) - 1)
  tvz <- attr(x$model,"tv")[1]
  
  for (i in 1:nrow(att)) {
    att[i,] <- att[i,] + 
      x$P[,,i] %*% 
      t(solve(innov$F[,,i], x$model$Z[, , tvz * (i - 1) + 1, drop = FALSE])) %*%
      innov$v[i, ]
  }
  att
}
# }

Run the code above in your browser using DataLab