Learn R Programming

dsp (version 1.2.0)

build_Q: Compute the quadratic term in Bayesian trend filtering

Description

Compute the quadratic term arising in the full conditional distribution of a Bayesian trend filtering model with D = 1 or D = 2. This function exploits the known D-banded structure of Q to compute the matrix directly, using objects in the Matrix package.

Usage

build_Q(obs_sigma_t2, evol_sigma_t2, D = 1)

Value

Banded T x T Matrix (object) Q

Arguments

obs_sigma_t2

the T x 1 vector of observation error variances

evol_sigma_t2

the T x 1 vector of evolution error variances

D

the degree of differencing (one or two)