qsmooth.qper {qfa}R Documentation

Quantile Smoothing of Quantile Periodogram or Spectral Estimate

Description

This function computes quantile-smoothed version of quantile periodogram/cross-periodogram (QPER) or other quantile spectral estimate.

Usage

qsmooth.qper(
  y.qper,
  method = c("gamm", "sp"),
  spar = "GCV",
  n.cores = 1,
  cl = NULL
)

Arguments

y.qper

matrix or array of quantile periodogram/cross-periodogram or spectral estimate

method

smoothing method: "gamm" for mgcv::gamm() (default), "sp" for stats::smooth.spline()

spar

smoothing parameter in smooth.spline() if method = "sp" (default = "GCV")

n.cores

number of cores for parallel computing (default = 1)

cl

pre-existing cluster for repeated parallel computing (default = NULL)

Value

matrix or array of quantile-smoothed quantile spectral estimate

Examples

y1 <- stats::arima.sim(list(order=c(1,0,0), ar=0.5), n=64)
y2 <- stats::arima.sim(list(order=c(1,0,0), ar=-0.5), n=64)
tau <- seq(0.1,0.9,0.05)
n <- length(y1)
ff <- c(0:(n-1))/n
sel.f <- which(ff > 0 & ff < 0.5)
y.qdft <- qdft(cbind(y1,y2),tau)
y.qacf <- qdft2qacf(y.qdft)
y.qper.lw <- qspec.lw(y.qacf,M=5)$spec
qfa.plot(ff[sel.f],tau,Re(y.qper.lw[1,1,sel.f,]))
y.qper.lwqs <- qsmooth.qper(y.qper.lw,method="sp",spar=0.9)
qfa.plot(ff[sel.f],tau,Re(y.qper.lwqs[1,1,sel.f,]))

[Package qfa version 2.1 Index]