View source: R/hatvalues.KFS.R
hatvalues.KFS | R Documentation |
Extract hat values from KFS output, when KFS
was run with signal
(non-Gaussian case) or mean smoothing (Gaussian case).
## S3 method for class 'KFS'
hatvalues(model, ...)
model |
An object of class |
... |
Additional arguments to |
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).
Multivariate time series containing hat values.
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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.