Learn R Programming

dlm (version 0.7-1)

dlmModReg: Create a DLM representation of a regression model

Description

The function creates a dlm representation of a linear regression model.

Usage

dlmModReg(X, addInt = TRUE, dV = 1, dW = rep(0, NCOL(X) + addInt),
m0 = rep(0, length(dW)), C0 = 1e+07 * diag(nrow = length(dW)))

Arguments

X
The design matrix
addInt
Logical: should an intercept be added?
dV
Variance of the observations.
dW
Variance of the system noise.
m0
$m0$
C0
$C0$

Value

  • An object of class dlm representing the specified regression model.

Details

By setting dW equal to a nonzero vector one obtains a DLM representation of a dynamic regression model. The default value zero of dW corresponds to standard linear regression. Only univariate regression is currently covered.

References

West and Harrison, Bayesian forecasting and dynamic models (2nd ed.), Springer, 1997.

See Also

dlmModARMA, dlmModPoly, dlmModSeas

Examples

Run this code
x <- matrix(runif(6,4,10), nc = 2); x
dlmModReg(x)
dlmModReg(x, addInt = FALSE)

Run the code above in your browser using DataLab