Learn R Programming

KFAS (version 1.5.1)

is.SSModel: Test whether object is a valid SSModel object

Description

Function is.SSModel tests whether the object is a valid SSModel object.

Usage

is.SSModel(object, na.check = FALSE, return.logical = TRUE)

Value

Logical value or nothing, depending on the value of

return.logical.

Arguments

object

An object to be tested.

na.check

Test the system matrices for NA and infinite values. Also checks for large values (> 1e7) in covariance matrices H and Q which could cause large rounding errors in filtering. Positive semidefiniteness of these matrices is not checked. Default is FALSE.

return.logical

If FALSE (default), an error is given if the the model is not a valid SSModel object. Otherwise logical value is returned.

Details

Note that the validity of the values in y and Z are not tested. These can contain NA values (but not infinite values), with condition that when Z[i,,t] contains NA value, the corresponding y[t,i] must also have NA value. In this case Z[i,,t] is not referenced in filtering and smoothing, and algorithms works properly.

Examples

Run this code
model <- SSModel(rnorm(10) ~ 1)
is.SSModel(model)
model['H'] <- 1
is.SSModel(model)
model$H[] <- 1
is.SSModel(model)
model$H[,,1] <- 1
is.SSModel(model)
model$H <- 1
is.SSModel(model)

Run the code above in your browser using DataLab