Bayesian Nonparametric Spectral Density Estimation Using
B-Spline Priors

Implementation of a Metropolis-within-Gibbs MCMC algorithm to flexibly estimate the spectral density of a stationary time series. The algorithm updates a nonparametric B-spline prior using the Whittle likelihood to produce pseudo-posterior samples and is based on the work presented in Edwards, M.C., Meyer, R. and Christensen, N., Statistics and Computing (2018). .

This package allows the user to flexibly estimate the spectral density of a stationary time series using a Bayesian nonparametric B-spline prior (of any degree). It works particularly well for complicated spectral structures (compared to the Bernstein polynomial prior).

How do I use bsplinePsd?

The primary function gibbs_bspline is straightforward to use. Most of the arguments are defaults (i.e., a noninformative prior). All you need to do is input a numeric vector (your time series), the number of iterations to run the MCMC algorithm for, and the amount of burn-in.

How do I get bsplinePsd?

Download from CRAN. Use install.packages("bsplinePsd") in R.

News

bsplinePsd 0.6.0

Have included a scaling/rescaling factor within the code to remove numerical errors when data is close to machine precision.

Have optimised the starting values for the Dirichlet process parameters.

bsplinePsd 0.5.0

Previous versions only allowed the user to use cubic B-spline densities. This version allows the user to choose any degree. Normalising the B-splines now uses a trivial integral formula.

The function gibbs_bspline can now handle odd length time series.

An S3 plot method has been included so the user can easily plot their PSD estimate.

bsplinePsd 0.2.0

Added an argument called k1 in the gibbs_bspline function. This allows the user to specify the starting value for parameter k. If well-chosen, this can speed up convergence significantly. The default is set to 20, which works well on all of the cases I have come across. If missing (NA), then a random integer between degree + 2 and kmax will be selected as the starting value for k.