Run the MCMC for B-spline fitting with a penalty the B-spline basis coefficients. The penalty is determined by the prior on the evolution errors, which include:
the dynamic horseshoe prior ('DHS');
the static horseshoe prior ('HS');
the Bayesian lasso ('BL');
the normal stochastic volatility model ('SV');
the normal-inverse-gamma prior ('NIG').
In each case, the evolution error is a scale mixture of Gaussians. Sampling is accomplished with a (parameter-expanded) Gibbs sampler, mostly relying on a dynamic linear model representation.
btf_bspline0(
y,
times = NULL,
num_knots = NULL,
evol_error = "DHS",
nsave = 1000,
nburn = 1000,
nskip = 4,
mcmc_params = list("mu", "yhat", "beta", "evol_sigma_t2", "obs_sigma_t2", "dhs_phi",
"dhs_mean"),
computeDIC = TRUE,
verbose = TRUE
)
A named list of the nsave
MCMC samples for the parameters named in mcmc_params
the T x 1
vector of time series observations
the T x 1
vector of observation points; if NULL, assume equally spaced
the number of knots; if NULL, use the default of max(20, min(ceiling(T/4), 150))
the evolution error distribution; must be one of 'DHS' (dynamic horseshoe prior), 'HS' (horseshoe prior), 'BL' (Bayesian lasso), or 'NIG' (normal-inverse-gamma prior)
number of MCMC iterations to record
number of MCMC iterations to discard (burin-in)
number of MCMC iterations to skip between saving iterations, i.e., save every (nskip + 1)th draw
named list of parameters for which we store the MCMC output; must be one or more of:
"mu" (conditional mean)
"beta" (B-spline basis coefficients)
"yhat" (posterior predictive distribution)
"evol_sigma_t2" (evolution error variance)
"obs_sigma_t2" (observation error variance)
"dhs_phi" (DHS AR(1) coefficient)
"dhs_mean" (DHS AR(1) unconditional mean)
logical; if TRUE, compute the deviance information criterion DIC
and the effective number of parameters p_d
logical; should R report extra information on progress?