Learn R Programming

quantspec (version 1.2-4)

getPointwiseCIs-LagEstimator: Get pointwise confidence intervals for the quantile spectral density kernel

Description

Returns a list of two arrays lowerCIs and upperCIs that contain the upper and lower limits for a level 1-alpha confidence interval of the copula spectral density kernel. Each array is of dimension [J,K1,K2], where J=length(frequencies), K1=length(levels.1), and K2=length(levels.2)). At position (j,k1,k2) the real (imaginary) part of the returned values are the bounds of the confidence interval for the the real (imaginary) part of the quantile spectrum, which corresponds to frequencies[j], levels.1[k1] and levels.2[k2] closest to the Fourier frequencies, levels.1 and levels.2 available in object; closest.pos is used to determine what closest to means.

Usage

# S4 method for LagEstimator
getPointwiseCIs(
  object,
  frequencies = 2 * pi * (0:(length(object@Y) - 1))/length(object@Y),
  levels.1 = getLevels(object, 1),
  levels.2 = getLevels(object, 2),
  alpha = 0.1,
  type = c("naive.sd", "boot.sd", "boot.full")
)

Value

Returns a named list of two arrays lowerCIS and upperCIs

containing the lower and upper bounds for the confidence intervals.

Arguments

object

LagEstimator of which to get the confidence intervals

frequencies

a vector of frequencies for which to get the result

levels.1

the first vector of levels for which to get the result

levels.2

the second vector of levels for which to get the result

alpha

the level of the confidence interval; must be from \((0,1)\)

type

a flag indicating which type of confidence interval should be returned; can only take one values at the moment.

Details

Currently, only one type of confidence interval is available:

  • "naive.sd": confidence intervals based on the asymptotic normality of the lag-window estimator; standard deviations are estimated using getSdNaive.

Examples

Run this code
lagEst <- lagEstimator(rnorm(2^10), levels.1=0.5)
CI.upper <- Re(getPointwiseCIs(lagEst)$upperCIs[,1,1])
CI.lower <- Re(getPointwiseCIs(lagEst)$lowerCIs[,1,1])
freq = 2*pi*(0:1023)/1024
plot(x = freq, y = rep(0.25/(2*pi),1024),
   ylim=c(min(CI.lower), max(CI.upper)),
   type="l", col="red") # true spectrum
lines(x = freq, y = CI.upper)
lines(x = freq, y = CI.lower)

Run the code above in your browser using DataLab