Learn R Programming

quantspec (version 1.2-4)

getValues-QuantilePG: Get values from a quantile periodogram.

Description

For vectors frequencies, levels.1 and levels.2 the values from an object of type QuantilePG are returned.

Usage

# S4 method for QuantilePG
getValues(
  object,
  frequencies = 2 * pi * (0:(lenTS(object@freqRep@Y) - 1))/lenTS(object@freqRep@Y),
  levels.1 = getLevels(object, 1),
  levels.2 = getLevels(object, 2),
  d1 = 1:(dim(object@freqRep@Y)[2]),
  d2 = 1:(dim(object@freqRep@Y)[2])
)

Value

Returns data from the array values that's a slot of

object.

Arguments

object

QuantilePG of which to get the values

frequencies

a vector of frequencies for which to get the values

levels.1

the first vector of levels for which to get the values

levels.2

the second vector of levels for which to get the values

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

Details

Fetching of the periodogram values basically happens by passing frequencies and the union of levels.1 and levels.2 to getValues. Therefore, the parameters frequencies, levels.1 and levels.1 are expected to be vectors of reals; an error is thrown otherwise. If any of the frequencies, levels.1 and levels.2 requested is not available from object a warning is issued. Note that the frequencies are transformed to \([0,\pi]\) using frequenciesValidator when checking if they are available in object.

The returned array of values is of dimension [J,K1,K2,B+1], where J=length(frequencies), K1=length(levels.1), K2=length(levels.2)), and B denotes the value stored in slot B of freqRep that's a slot of object. At position (j,k1,k2,b) the returned value is the one corresponding to frequencies[j], levels.1[k1] and levels.2[k2] that are closest to the frequencies, levels.1 and levels.2 available in object; closest.pos is used to determine what closest to means.

Examples

Run this code
Y        <- rnorm(32)
freq     <- 2*pi*c(0:31)/32
levels   <- c(0.25,0.5,0.75)
qPG      <- quantilePG(Y, levels.1=levels)
V.all    <- getValues(qPG)
V.coarse <- getValues(qPG, frequencies = 2*pi*c(0:15)/16)
V.fine   <- getValues(qPG, frequencies = 2*pi*c(0:63)/64)
V.part   <- getValues(qPG, frequencies = 2*pi*c(0:16)/32,
                           levels.1 = c(0.25), levels.2 = c(0.5,0.75))

Run the code above in your browser using DataLab