getPointwiseCIs-SmoothedPG: Get pointwise confidence intervals for the quantile spectral...

Description Usage Arguments Details Value Examples

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 quantity of interest. Each array is of dimension [J,K1,K2] if a univariate time series is being analysed or of dimension [J,D1,K1,D2,K2], where J=length(frequencies), D1=length(d1), D2=length(d2), K1=length(levels.1), and K2=length(levels.2)). At position (j,k1,k2) or (j,i1,k1,i2,k2) the real (imaginary) part of the returned values are the bounds of the confidence interval for the the real (imaginary) part of the quantity under anlysis, which corresponds to frequencies[j], d1[i1], d2[i2], 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## S4 method for signature 'SmoothedPG'
getPointwiseCIs(
  object,
  quantity = c("spectral density", "coherency", "coherence"),
  frequencies = 2 * pi * (0:(lenTS(object@qPG@freqRep@Y) -
    1))/lenTS(object@qPG@freqRep@Y),
  levels.1 = getLevels(object, 1),
  levels.2 = getLevels(object, 2),
  d1 = 1:(dim(object@values)[2]),
  d2 = 1:(dim(object@values)[4]),
  alpha = 0.1,
  type = c("naive.sd", "boot.sd", "boot.full")
)

Arguments

object

SmoothedPG of which to get the confidence intervals

quantity

a flag indicating for which the pointwise confidence bands will be determined. Can take one of the possible values discussed above.

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

d1

optional parameter that determine for which j1 to return the data; may be a vector of elements 1, ..., D

d2

same as d1, but for j2

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.

Details

Currently, pointwise confidence bands for two different quantity are implemented:

Currently, three different types of confidence intervals are available:

Value

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

Examples

1
2
3
4
5
6
7
8
9
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)

quantspec documentation built on July 15, 2020, 1:07 a.m.