Learn R Programming

quantspec (version 1.0-0)

QuantileSD-class: Class for a simulated quantile (i. e., Laplace or copula) density kernel.

Description

QuantileSD is an S4 class that implements the necessary calculations to determine a numeric approximation to the quantile spectral density kernel of a model from which a time series of length N can be sampled via a function call ts(N).

Arguments

Details

In the simulation a number of R independent quantile periodograms based on the clipped time series are simulated. If type=="copula", then the rank-based version is used. The sum and the sum of the squared absolute value is stored to the slots sumPG and sumSqPG. After the simulation is completed the mean and it's standard error (of the simulated quantile periodograms) are determined and stored to meanPG and stdError. Finally, the (copula) spectral density kernel is determined by smoothing real and imaginary part of meanPG seperately for each combination of levels using smooth.spline. Note that, all remarks made in the documentation of the super-class QSpecQuantity apply.

References

Dette, H., Hallin, M., Kley, T. & Volgushev, S. (2014+). Of Copulas, Quantiles, Ranks and Spectra: an $L_1$-approach to spectral analysis. Bernoulli, forthcoming. Kley, T., Volgushev, S., Dette, H. & Hallin, M. (2014). Quantile Spectral Processes: Asymptotic Analysis and Inference. http://arxiv.org/abs/1401.8104.

See Also

Examples for implementations of functions ts can be found at: ts-models.

Examples

Run this code
## This script can be used to create and store a QuantileSD object

## Parameters for the simulation:
R <- 50                      # number of independent repetitions;
                             # R should be much larger than this in practice!
N <- 2^8                     # number of Fourier frequencies in [0,2pi)
ts <- ts1                    # time series model
levels <- seq(0.1,0.9,0.1)   # quantile levels
type <- "copula"             # copula, not Laplace, spectral density kernel
seed.init <- 2581            # seed for the pseudo random numbers

## Simulation takes place once the constructor is invoked
qsd <- quantileSD(N=N, seed.init = 2581, type = type,
    ts = ts, levels.1=levels, R = R)

## The simulated copula spectral density kernel can be called via
V1 <- getValues(qsd)

## It is also possible to fetch the result for only a few levels
levels.few <- c(0.2,0.5,0.7)
V2 <- getValues(qsd, levels.1=levels.few, levels.2=levels.few)

## If desired additional repetitions can be performed to yield a more precise
## simulation result by calling; here the number of independent runs is doubled.
qsd <- increasePrecision(qsd,R)

## Often the result will be stored for later usage.  
save(qsd, file="QAR1.rdata")

## Take a brief look at the result of the simulation
plot(qsd, levels=levels.few)

## When plotting more than only few levels it may be a good idea to plot to
## another device; e. g., a pdf-file
K <- length(levels)
pdf("QAR1.pdf", width=2*K, height=2*K)
  plot(qsd)
dev.off()

Run the code above in your browser using DataLab