QRegEstimator-constructor: Create an instance of the 'QRegEstimator' class.

Description Usage Arguments Value Examples

Description

The parameter type.boot can be set to choose a block bootstrapping procedure. If "none" is chosen, a moving blocks bootstrap with l=length(Y) and N=length(Y) would be done. Note that in that case one would also chose B=0 which means that getPositions would never be called. If B>0 then each bootstrap replication would be the undisturbed time series.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
qRegEstimator(
  Y,
  frequencies = 2 * pi/lenTS(Y) * 0:(lenTS(Y) - 1),
  levels = 0.5,
  isRankBased = TRUE,
  B = 0,
  l = 0,
  type.boot = c("none", "mbb"),
  method = c("br", "fn", "pfn", "fnc", "lasso", "scad"),
  parallel = FALSE
)

Arguments

Y

A vector of real numbers containing the time series from which to determine the quantile periodogram or a ts object or a zoo object.

frequencies

A vector containing frequencies at which to determine the QRegEstimator.

levels

A vector of length K containing the levels x at which the QRegEstimator is to be determined.

isRankBased

If true the time series is first transformed to pseudo data [cf. FreqRep].

B

number of bootstrap replications

l

(expected) length of blocks

type.boot

A flag to choose a method for the block bootstrap; currently two options are implemented: "none" and "mbb" which means to do a moving blocks bootstrap with B and l as specified.

method

method used for computing the quantile regression estimates. The choice is passed to qr; see the documentation of quantreg for details.

parallel

a flag to allow performing parallel computations.

Value

Returns an instance of QRegEstimator.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
library(snowfall)

Y <- rnorm(100) # Try 2000 and parallel computation will in fact be faster.

# Compute without using snowfall capabilities
system.time(
  qRegEst1 <- qRegEstimator(Y, levels=seq(0.25,0.75,0.25), method="fn", parallel=FALSE)
)

# Set up snowfall
sfInit(parallel=TRUE, cpus=2, type="SOCK")
sfLibrary(quantreg)
sfExportAll()

# Compare how much faster the computation is when done in parallel
system.time(
  qRegEst2 <- qRegEstimator(Y, levels=seq(0.25,0.75,0.25), method="fn", parallel=TRUE)
)

sfStop()

# Compare results
V1 <- getValues(qRegEst1)
V2 <- getValues(qRegEst2)
sum(abs(V1-V2)) # Returns: [1] 0

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