Learn R Programming

quantspec (version 1.0-0)

getValues-FreqRep: Get values from a frequency representation.

Description

For two vectors frequencies and levels the values from an object of type FreqRep are returned.

Usage

## S3 method for class 'FreqRep':
getValues(object, frequencies = 2 * pi *
  (0:(length(object@Y) - 1))/length(object@Y), levels = object@levels)

Arguments

object
FreqRep of which to get the values
frequencies
a vector of frequencies for which to get the values
levels
a vector of levels for which to get the values

Value

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

Details

The two parameters frequencies and levels are expected to be vectors of reals; an error is thrown otherwise. If any of the frequencies or levels requested is not available from object a warning is issued, and the values with frequencies and levels closest to the ones requested are returned. 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,K,B+1], where J=length(frequencies), K=length(levels), and B denotes the value stored in slot B of object. At position (j,k,b) the returned value is the one corresponding to frequencies[j] and levels[k] that are closest to the frequencies and levels 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)
cFT      <- clippedFT(Y, freq, levels)
V.all    <- getValues(cFT)
V.coarse <- getValues(cFT, frequencies = 2*pi*c(0:15)/16, levels = levels)
V.fine   <- getValues(cFT, frequencies = 2*pi*c(0:63)/64, levels = levels)
V.part   <- getValues(cFT, frequencies = 2*pi*c(0:16)/32, levels = c(0.25))

Run the code above in your browser using DataLab