qspec.sar: Spline Autoregression (SAR) Estimator of Quantile Spectrum

View source: R/qfa4.2.R

qspec.sarR Documentation

Spline Autoregression (SAR) Estimator of Quantile Spectrum

Description

This function computes spline autoregression (SAR) estimate of quantile spectrum.

Usage

qspec.sar(
  y,
  y.qser = NULL,
  tau0,
  tau = tau0,
  p = NULL,
  order.max = NULL,
  spar = NULL,
  method = c("GCV", "AIC", "BIC"),
  weights = rep(1, length(tau0)),
  interval = c(-1.5, 1.5),
  freq = NULL,
  n.cores = 1,
  cl = NULL
)

Arguments

y

vector or matrix of time series (if matrix, nrow(y) = length of time series)

y.qser

matrix or array of pre-calculated QSER at tau0 (default = NULL: compute from y and tau0); if supplied, y can be left unspecified

tau0

quantile levels used to computer QSER (must be supplied with or without y.qser)

tau

quantile levels for evaluation (min(tau0) <= tau <= max(tau0); default = tau0)

p

order of SAR model (default = NULL: automatically selected by AIC)

order.max

maximum order for AIC if p = NULL (default = NULL: determined by stats::ar())

spar

penalty parameter alla stats::smooth.spline() (default = NULL: automatically selected)

method

criterion for penalty parameter selection: "GCV" (default), "AIC", or "BIC"

weights

sequence of weights (length(weights) = length(tau0); default: weights = rep(1,length(tau0)))

interval

interval for spar optimization (default: interval = c(-1.5,1.5))

freq

sequence of frequencies in [0,1) (default = NULL: all Fourier frequencies)

n.cores

number of cores for parallel computing of QDFT if y.qser = NULL (default = 1)

cl

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

Value

a list with the following elements:

spec

matrix or array of SAR quantile spectrum

freq

sequence of frequencies

fit

object of SAR model

qser

matrix or array of quantile series if y.qser = NULL

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)
# compute from time series
y.sar <- qspec.sar(cbind(y1,y2),tau0=tau,p=1)
qfa.plot(ff[sel.f],tau,Re(y.sar$spec[1,1,sel.f,]))
# compute from quantile series
y.qser <- qser(cbind(y1,y2),tau)
y.sar <- qspec.sar(y.qser=y.qser,tau0=tau,p=1)
qfa.plot(ff[sel.f],tau,Re(y.sar$spec[1,1,sel.f,]))

qfa documentation built on Sept. 11, 2025, 9:09 a.m.

Related to qspec.sar in qfa...