Package: dsp 1.4.1

dsp: Dynamic Shrinkage Process and Change Point Detection

Provides efficient Markov chain Monte Carlo (MCMC) algorithms for dynamic shrinkage processes, which extend global-local shrinkage priors to the time series setting by allowing shrinkage to depend on its own past. These priors yield locally adaptive estimates, useful for time series and regression functions with irregular features. The package includes full MCMC implementations for trend filtering using dynamic shrinkage on signal differences, producing locally constant or linear fits with adaptive credible bands. Also included are models with static shrinkage and normal-inverse-Gamma priors for comparison. Additional tools cover dynamic regression with time-varying coefficients and B-spline models with shrinkage on basis differences, allowing for flexible curve-fitting with unequally spaced data. Some support for heteroscedastic errors, outlier detection, and change point estimation. Methods in this package are described in Kowal et al. (2019) <doi:10.1111/rssb.12325>, Wu et al. (2024) <doi:10.1080/07350015.2024.2362269>, Schafer and Matteson (2024) <doi:10.1080/00401706.2024.2407316>, and Cho and Matteson (2024) <doi:10.48550/arXiv.2408.11315>.

Authors:Daniel R. Kowal [aut, cph], Haoxuan Wu [aut], Toryn Schafer [aut, cre], Jason B. Cho [aut], David S. Matteson [aut]

dsp_1.4.1.tar.gz
dsp_1.4.1.zip(r-4.7)dsp_1.4.1.zip(r-4.6)dsp_1.4.1.zip(r-4.5)
dsp_1.4.1.tgz(r-4.6-x86_64)dsp_1.4.1.tgz(r-4.6-arm64)dsp_1.4.1.tgz(r-4.5-x86_64)dsp_1.4.1.tgz(r-4.5-arm64)
dsp_1.4.1.tar.gz(r-4.7-arm64)dsp_1.4.1.tar.gz(r-4.7-x86_64)dsp_1.4.1.tar.gz(r-4.6-arm64)dsp_1.4.1.tar.gz(r-4.6-x86_64)
dsp_1.4.1.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
dsp/json (API)
NEWS

# Install 'dsp' in R:
install.packages('dsp', repos = c('https://schafert.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/schafert/dsp/issues

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cpp

3.78 score 2 stars 6 scripts 435 downloads 4 exports 74 dependencies

Last updated from:893858ce2c. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK208
linux-devel-x86_64OK253
source / vignettesOK215
linux-release-arm64OK228
linux-release-x86_64OK214
macos-release-arm64OK171
macos-release-x86_64OK287
macos-oldrel-arm64OK205
macos-oldrel-x86_64OK447
windows-develOK183
windows-releaseOK176
windows-oldrelOK233
wasm-releaseOK141

Exports:dsp_fitdsp_specsimRegressionsimUnivariate

Dependencies:ashBayesLogitbitopscliclustercodacolorspacecpp11crayondeSolvedotCall64evdexpmfarverfdafdsFNNgenericsggplot2gluegtablehdrcdehmsisobandkernlabKernSmoothkslabelinglatticelifecyclelocfitmagrittrMASSMatrixMatrixModelsmclustmcmcMCMCpackmgcvmsmmulticoolmvtnormnlmepcaPPpgdrawpillarpkgconfigpracmaprettyunitsprogresspurrrquantregR6rainbowRColorBrewerRcppRcppArmadilloRcppEigenRcppGSLRcppZigguratRCurlrlangS7scalesspamSparseMstochvolsurvivaltibbletruncdistutf8vctrsviridisLitewithr

Readme and manuals

Help Manual

Help pageTopics
Adaptive Bayesian Changepoint with Outliersabco
MCMC Sampler for Bayesian Trend Filteringbtf
MCMC Sampler for B-spline Bayesian Trend Filteringbtf_bspline
MCMC Sampler for B-spline Bayesian Trend Filtering: D = 0btf_bspline0
MCMC Sampler for Bayesian Trend Filtering: Regressionbtf_reg
Run the MCMC for sparse Bayesian trend filteringbtf_sparse
MCMC Sampler for Bayesian Trend Filtering: D = 0btf0
Compute the quadratic term in Bayesian trend filteringbuild_Q
Compute X'Xbuild_XtX
Function for calculating DIC and Pb (Bayesian measures of model complexity and fit by Spiegelhalter et al. 2002)computeDIC_ASV
Compute Simultaneous Credible BandscredBands
MCMC Sampler for Models with Dynamic Shrinkage Processesdsp_fit print.dsp
Model Specificationdsp_spec print.dsp_spec
Compute the ergodic (running) mean.ergMean
MCMC Sampler for Adaptive Stchoastic Volatility (ASV) modelfit_ASV
Helper function for Sampling parameters for ASV modelfit_paramsASV
Helper function for Sampling parameters for ASV model with a nugget Effectfit_paramsASV_n
Posterior predictive sampler on the transformed y (log(y^2))generate_ly2hat
Compute the design matrix X for AR(p) modelgetARpXmat
Summarize of effective sample sizegetEffSize
Compute Non-Zeros (Signals)getNonZeros
Helper function for initializing parameters for ASV modelinit_paramsASV
Helper function for initializing parameters for ASV model with a nugget effectinit_paramsASV_n
Compute initial Cholesky decomposition for Bayesian Trend FilteringinitChol_spam
Compute initial Cholesky decomposition for TVP RegressioninitCholReg_spam
Initialize the evolution error variance parametersinitDHS
Initialize the parameters for the initial state varianceinitEvol0
Initialize the evolution error variance parametersinitEvolParams
Initialize the stochastic volatility parametersinitSV
Compute the inverse log-oddsinvlogit
Compute the log-oddslogit
Sample components from a discrete mixture of normalsncind
Plot the Bayesian trend filtering fitted valuesplot.dsp
Predict changepoints from the output of ABCOpredict.dsp
Sampling from 10-component Gaussian Mixture component described in Omori et al. 2007sample_j_wrap
Wrapper function for C++ call for sample mat, check pre-conditions to prevent crashsample_mat_c
Sample the AR(1) coefficient(s)sampleAR1
Sampler for first or second order random walk (RW) Gaussian dynamic linear model (DLM)sampleBTF
Sampler for first or second order random walk (RW) Gaussian dynamic linear model (DLM)sampleBTF_bspline
Sampler for first or second order random walk (RW) Gaussian dynamic linear model (DLM)sampleBTF_reg
(Backfitting) Sampler for first or second order random walk (RW) Gaussian dynamic linear model (DLM)sampleBTF_reg_backfit
Sampler for first or second order random walk (RW) Gaussian dynamic linear model (DLM) with additional shrinkage to zerosampleBTF_sparse
Sample the dynamic shrinkage process parameterssampleDSP
Sample the parameters for the initial state variancesampleEvol0
Sampler evolution error variance parameterssampleEvolParams
Sample a Gaussian vector using the fast sampler of BHATTACHARYA et al.sampleFastGaussian
Sample the AR(1) unconditional meanssampleLogVolMu
Sample the mean of AR(1) unconditional meanssampleLogVolMu0
Sample the latent log-volatilitiessampleLogVols
Sampler for the stochastic volatility parameterssampleSVparams
Sampler for the stochastic volatility parameters using same functions as DHS priorsampleSVparams0
Compute Simultaneous Band Scores (SimBaS)simBaS
Simulate noisy observations from a dynamic regression modelsimRegression
Simulate noisy observations from a dynamic regression modelsimRegression0
Generate univariate signals of different typesimUnivariate
Compute the spectrum of an AR(p) modelspec_dsp
Summarize DSP MCMC chainssummary.dsp
Initializer for location indices for filling in band-sparse matrixt_create_loc
Initialize the evolution error variance parameterst_initEvolParams_no
Initialize the anomaly component parameterst_initEvolZeta_ps
Initialize the stochastic volatility parameterst_initSV
Sample the TAR(1) coefficientst_sampleAR1
Sampler for first or second order random walk (RW) Gaussian dynamic linear model (DLM)t_sampleBTF
Sample the thresholded dynamic shrinkage process parameterst_sampleEvolParams
Sampler for the anomaly component parameterst_sampleEvolZeta_ps
Sample the TAR(1) unconditional meanst_sampleLogVolMu
Sample the latent log-volatilitiest_sampleLogVols
Sample the threshold parametert_sampleR_mh
Sampler for the stochastic volatility parameterst_sampleSVparams
Univariate Slice Sampler from Neal (2008)uni.slice