sampleBTF_bspline: Sampler for first or second order random walk (RW) Gaussian...

View source: R/component_samplers.R

sampleBTF_bsplineR Documentation

Sampler for first or second order random walk (RW) Gaussian dynamic linear model (DLM)

Description

Compute one draw of the p x 1 B-spline basis coefficients beta in a DLM using back-band substitution methods. The coefficients are penalized with a prior on the D = 0, D = 1, or D = 2 differences. This model is equivalent to the Bayesian trend filtering (BTF) model applied to p x 1 vector of equally-spaced B-spline coefficients, with the basis matrix serving as a design matrix in the observation equation.

Usage

sampleBTF_bspline(
  y,
  X,
  obs_sigma2,
  evol_sigma_t2,
  XtX_bands,
  Xty = NULL,
  D = 1
)

Arguments

y

the T x 1 vector of time series observations

X

the T x p basis matrix

obs_sigma2

the scalar observation error variance

evol_sigma_t2

the p x 1 vector of evolution error variances

XtX_bands

list with 4 vectors consistint of the 4-bands of XtX = crossprod(X) (one-time cost)

Xty

the p x 1 matrix crossprod(X,y), which is a one-time cost (assuming no missing entries in y)

D

the degree of differencing (zero, one, or two)

Value

p x 1 vector of simulated basis coefficients beta

Note

Missing entries (NAs) are not permitted in y. Imputation schemes are available.


drkowal/dsp documentation built on July 19, 2023, 11:42 a.m.