Learn R Programming

exdqlm (version 0.4.0)

regMod: Create a standard regression component for an exDQLM

Description

The function constructs a regression block where the observation vector at time \(t\) is \(F_t = X_t\) (row of the design matrix), and the state evolves as \(\theta_t = \theta_{t-1}\) (i.e., \(G_t = I_n\)).

Usage

regMod(X, m0, C0)

Value

An object of class "exdqlm" with elements:

  • FF - \(n \times T\) matrix with column \(t\) equal to \(F_t = X_t\).

  • GG - \(n \times n\) identity matrix (static coefficients).

  • m0, C0 - Prior mean/covariance for regression coefficients.

Arguments

X

A numeric matrix of dimension \(T \times n\) (T time points, n regressors). Vectors are accepted and treated as \(T \times 1\).

m0

Optional numeric prior mean (length n). Defaults to zeros.

C0

Optional numeric prior covariance (\(n \times n\)). Defaults to \(10^3 I_n\).

Details

Input X is a \(T \times n\) matrix of regressors; the returned FF is an \(n \times T\) matrix (i.e., t(X)), consistent with component composition via +.exdqlm.

Examples

Run this code
data("climateIndices", package = "exdqlm")

T <- 150
bt_dates <- seq(as.Date("1987-01-01"), by = "month", length.out = T)
idx <- match(bt_dates, climateIndices$date)
X <- scale(climateIndices[idx, c("noi", "amo")])

# Single regressor (T x 1)
reg1 = regMod(X[, "noi"])
# Multiple regressors (T x n)
reg2 = regMod(X)

# Combine with trend/seasonal components
trend.comp = polytrendMod(order = 3, m0 = rep(0,3), C0 = diag(3))
seas.comp  = seasMod(p = 12, h = 1, C0 = diag(1, 2))
base.mod   = trend.comp + seas.comp
model.std  = base.mod + reg2

Run the code above in your browser using DataLab