plot.SSModel: Diagnostic Plots of State Space Models

View source: R/plot.SSModel.R

plot.SSModelR Documentation

Diagnostic Plots of State Space Models

Description

Diagnostic plots based on standardized residuals for objects of class SSModel.

Usage

## S3 method for class 'SSModel'
plot(x, nsim = 0, zerotol = 0, expected = FALSE, ...)

Arguments

x

Object of class SSModel.

nsim

The number of independent samples used in importance sampling. Only used for non-Gaussian model. Default is 0, which computes the approximating Gaussian model by approxSSM and performs the usual Gaussian filtering/smoothing so that the smoothed state estimates equals to the conditional mode of p(\alpha_t|y). In case of nsim = 0, the mean estimates and their variances are computed using the Delta method (ignoring the covariance terms).

zerotol

Tolerance parameter for positivity checking in standardization. Default is zero. The values of D <= zerotol * max(D, 0) are deemed to zero.

expected

Logical value defining the approximation of H_t in case of Gamma and negative binomial distribution. Default is FALSE which matches the algorithm of Durbin & Koopman (1997), whereas TRUE uses the expected value of observations in the equations, leading to results which match with glm (where applicable). The latter case was the default behaviour of KFAS before version 1.3.8. Essentially this is the difference between observed and expected information.

...

Ignored.

Examples

modelNile <- SSModel(Nile ~ SSMtrend(1, Q = list(matrix(NA))), H = matrix(NA))
modelNile <- fitSSM(inits = c(log(var(Nile)),log(var(Nile))), model = modelNile,
 method = "BFGS")$model

if (interactive()) {
  plot(modelNile)
}

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