View source: R/mcmc_samplers.R
btf_sparse | R Documentation |
Sparse Bayesian trend filtering has two penalties: (1) a penalty on the first (D = 1) or second (D = 2) differences of the conditional expectation and (2) a penalty on the conditional expectation, i.e., shrinkage to zero.
btf_sparse(
y,
evol_error = "DHS",
zero_error = "DHS",
D = 2,
obsSV = "const",
nsave = 1000,
nburn = 1000,
nskip = 4,
mcmc_params = list("mu", "yhat", "evol_sigma_t2", "obs_sigma_t2", "zero_sigma_t2",
"dhs_phi", "dhs_mean", "dhs_phi_zero", "dhs_mean_zero", "h", "h_smooth"),
computeDIC = TRUE,
verbose = TRUE,
D_asv = 1,
evol_error_asv = "HS",
nugget_asv = TRUE
)
y |
the |
evol_error |
the evolution error distribution; must be one of 'DHS' (dynamic horseshoe prior), 'HS' (horseshoe prior), 'BL' (Bayesian lasso), or 'NIG' (normal-inverse-gamma prior) |
zero_error |
the shrinkage-to-zero distribution; must be one of 'DHS' (dynamic horseshoe prior), 'HS' (horseshoe prior), 'BL' (Bayesian lasso), or 'NIG' (normal-inverse-gamma prior) |
D |
degree of differencing (D = 1, or D = 2) |
obsSV |
Options for modeling the error variance. It must be one of the following:
|
nsave |
number of MCMC iterations to record |
nburn |
number of MCMC iterations to discard (burnin-in) |
nskip |
number of MCMC iterations to skip between saving iterations, i.e., save every (nskip + 1)th draw |
mcmc_params |
named list of parameters for which we store the MCMC output; must be one or more of:
|
computeDIC |
logical; if TRUE, compute the deviance information criterion |
verbose |
logical; should R report extra information on progress? |
D_asv |
integer; degree of differencing (0, 1, or 2) for the ASV model. Only used when |
evol_error_asv |
character; evolution error distribution for the ASV model. Must be one of the five options used in |
nugget_asv |
logical; if |
Each penalty is determined by a prior, 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 prior is a scale mixture of Gaussians. Sampling is accomplished with a (parameter-expanded) Gibbs sampler, mostly relying on a dynamic linear model representation.
A named list of the nsave
MCMC samples for the parameters named in mcmc_params
The data y
may contain NAs, which will be treated with a simple imputation scheme
via an additional Gibbs sampling step. In general, rescaling y
to have unit standard
deviation is recommended to avoid numerical issues.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.