Learn R Programming

quantspec (version 1.0-0)

getPointwiseCIs-SmoothedPG: 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

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

Arguments

object
SmoothedPG 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 take one of the three values discussed above.

Value

  • Returns a named list of two arrays lowerCIS and upperCIs containing the lower and upper bounds for the confidence intervals.

Details

Currently, three different types of confidence intervals are available:
  • "naive.sd": confidence intervals based on the asymptotic normality of the smoothed quantile periodogram; standard deviations are estimated usinggetSdNaive.
  • "boot.sd": confidence intervals based on the asymptotic normality of the smoothed quantile periodogram; standard deviations are estimated usinggetSdBoot.
  • "boot.full": confidence intervals determined by estimating the quantiles of he distribution of the smoothed quantile periodogram, by the empirical quantiles of the sample of bootstrapped replications.

Examples

Run this code
sPG <- smoothedPG(rnorm(2^10), levels.1=0.5)
CI.upper <- Re(getPointwiseCIs(sPG)$upperCIs[,1,1])
CI.lower <- Re(getPointwiseCIs(sPG)$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