spec_pspline: Spectrum estimate via p-splines

View source: R/spec_pspline.R

spec_psplineR Documentation

Spectrum estimate via p-splines

Description

This function allows to estimate the spectrum

Usage

spec_pspline(
  data,
  l,
  p,
  eq = TRUE,
  Ntotal1,
  burnin1,
  thin1,
  Ntotal,
  burnin,
  thin,
  tau.alpha = 0.001,
  tau.beta = 0.001,
  phi.alpha = 1,
  phi.beta = 1,
  delta.alpha = 1e-04,
  delta.beta = 1e-04,
  k = NULL,
  eqSpacedKnots = FALSE,
  degree = 3,
  diffMatrixOrder = 1,
  printIter = 1000,
  recycl = FALSE,
  likePlot = FALSE
)

Arguments

data

numeric vector

l

length of the data subset to be analysed

p

overlapping percentage of the data subsets

eq

if is TRUE, last data subset has length l, even though the percentage is not p

Ntotal1

total number of iterations to run the pilot Markov chain

burnin1

number of initial iterations to be discarded in the pilot mcmc run

thin1

thinning number in the pilot mcmc run (post-processing)

Ntotal

total number of iterations to run the Markov chain

burnin

number of initial iterations to be discarded

thin

thinning number (post-processing)

tau.alpha, tau.beta

prior parameters for tau (Inverse-Gamma)

phi.alpha, phi.beta

prior parameters for phi (Gamma)

delta.alpha, delta.beta

prior parameters for delta (Gamma)

k

number of B-spline densities in the mixture

eqSpacedKnots

logical value indicating whether the knots are equally spaced or defined according to the periodogram

degree

positive integer specifying the degree of the B-spline densities (default is 3)

diffMatrixOrder

positive integer specifying the order of the difference penalty matrix in the P-splines (default is 2)

printIter

positive integer specifying the periodicity of the iteration number to be printed on screen (default 100)

recycl

if TRUE the mcmc analysis for a data subset is used to calibrate the proposal for the succesor data subset. It works for large p values.

likePlot

if TRUE, a likelihood traceplot is generated for each data subset

Value

A list with S3 class ‘psds’ containing the the power spectral estimates for the data subsets and and a list with relevant information about the analysis

See Also

gibbs_pspline

Examples

## Not run: 

set.seed(1)

# Generate AR(1) data with rho = 0.9
n = 128
data = arima.sim(n, model = list(ar = 0.9));
data = data - mean(data);

# Spectrum estimate via p-splines (may take some time)
spec = spec_pspline(data, l=50, p=90, Ntotal1=2000, burnin1=500, thin1=5,
                    Ntotal=1000, burnin=500, thin=5, k=30, recycl = TRUE);

image(spec) # Plot log PSD (see documentation of image.plot.psd)


## End(Not run)

pmat747/psplinePsd documentation built on July 7, 2023, 9:06 p.m.