dlmodeler.check: Check dimensions and validity

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/dlmodeler-core.R

Description

Checks a dlmodeler object, in particular for the consistency of the dimensions of its elements.

Usage

1
dlmodeler.check(model, yt = NULL)

Arguments

model

an object of class dlmodeler to check.

yt

an optional data vector to check with the model.

Details

See dlmodeler for information about the state-space representation adopted in this package.

Value

A list with the following information:

status

a boolean indicating whether the model is valid or not

m

dimension of state vector m

r

dimension of state disturbance covariance matrix r

d

dimension of observation vector d

timevar

a boolean indicating if the model has time-varying terms or not

timevar.Tt

the number of time steps in Tt, or NA if the matrix is constant

timevar.Rt

the number of time steps in Rt, or NA if the matrix is constant

timevar.Qt

the number of time steps in Qt, or NA if the matrix is constant

timevar.Zt

the number of time steps in Zt, or NA if the matrix is constant

timevar.Ht

the number of time steps in Ht, or NA if the matrix is constant

Author(s)

Cyrille Szymanski <[email protected]>

See Also

dlmodeler, dlmodeler.build

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require(dlmodeler)

# a stochastic level+trend DLM
mod <- dlmodeler.build(
		a0 = c(0,0), # initial state: (level, trend)
		P0 = diag(c(0,0)), # initial state variance set to...
		P0inf = diag(2), # ...use exact diffuse initialization
		matrix(c(1,0,1,1),2,2), # state transition matrix
		diag(c(1,1)), # state disturbance selection matrix
		diag(c(.5,.05)), # state disturbance variance matrix
		matrix(c(1,0),1,2), # observation design matrix
		matrix(1,1,1) # observation disturbance variance matrix
)
# print the model
mod
# check if it is valid
dlmodeler.check(mod)$status

# an empty DLM with 4 state variables (3 of which are stocastic)
# and bi-variate observations
mod <- dlmodeler.build(dimensions=c(4,3,2))
# print the model
mod
# check if it is valid
dlmodeler.check(mod)$status

dlmodeler documentation built on May 29, 2017, 11:33 a.m.