Learn R Programming

dlmodeler (version 1.4-2)

dlmodeler.operators: Add, multiply or bind models

Description

Add two DLMs together, performing an outer sum.

Multiply a model by a numeric constant.

Bind two DLMs together, creating a multi-variate model.

Usage

dlmodeler.add(e1, e2, name = NULL)
"+"(e1,e2)
dlmodeler.multiply(e1, e2)
"*"(e1,e2)
dlmodeler.bind(e1, e2, name = NULL)
"%%"(e1, e2)

Arguments

e1, e2
an object of class dlmodeler or a numeric value.
name
an optional name to be given to the resulting DLM.

Value

An object of class dlmodeler.

Details

Addition: The state vector of the resulting DLM is equal to the concatenation of the state vectors of mod1 and mod2. The observation vector of the resulting DLM is equal to the sum of the observation vectors of mod1 and mod2.

Multiplication: the observation vector of the resulting DLM is multiplied by the supplied numeric constant.

Binding: The state vector of the resulting DLM is equal to the concatenation of the state vectors of mod1 and mod2. The observation vector of the resulting DLM is equal to the concatenation of the observation vectors of mod1 and mod2.

References

Giovanni Petris, An R Package for Dynamic Linear Models. Journal of Statistical Software, 36(12), 1-16. http://www.jstatsoft.org/v36/i12/.

See Also

dlmodeler

Examples

Run this code
require(dlmodeler)

# create the following model:
# deterministic level + quarterly seasonal + disturbance
mod1 <- dlmodeler.build.polynomial(0,sigmaH=.1) +
        4* dlmodeler.build.dseasonal(4,sigmaH=0)

# create a multivariate model by binding the previous model
# with a stochastic trend model
mod2 <- mod1 %% dlmodeler.build.polynomial(1,sigmaH=0)

Run the code above in your browser using DataLab