hatvalues.KFS: Extract Hat Values from KFS Output

View source: R/hatvalues.KFS.R

hatvalues.KFSR Documentation

Extract Hat Values from KFS Output

Description

Extract hat values from KFS output, when KFS was run with signal (non-Gaussian case) or mean smoothing (Gaussian case).

Usage

## S3 method for class 'KFS'
hatvalues(model, ...)

Arguments

model

An object of class KFS.

...

Additional arguments to approxSSM.

Details

Hat values in KFAS are defined as the diagonal elements of V_t/H_t where V_t is the covariance matrix of signal/mean at time t and H_t is the covariance matrix of disturbance vector \epsilon of (approximating) Gaussian model at time t. This definition gives identical results with the standard definition in case of GLMs. Note that it is possible to construct a state space model where this definition is not meaningful (for example the covariance matrix H_t can contain zeros on diagonal).

Value

Multivariate time series containing hat values.

Examples

model <- SSModel(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings)
out <- KFS(model, filtering = "state", smoothing = "none")
# estimate sigma2
model["H"] <- mean(c(out$v[1:out$d][out$Finf==0]^2/out$F[1:out$d][out$Finf==0],
                     out$v[-(1:out$d)]^2/out$F[-(1:out$d)]))
c(hatvalues(KFS(model)))


KFAS documentation built on Sept. 8, 2023, 5:56 p.m.