Learn R Programming

quantspec (version 1.0-0)

SmoothedPG-constructor: Create an instance of the SmoothedPG class.

Description

A SmoothedPG object can be created from either
  • anumeric, ats, or azooobject
  • aQuantilePGobject.
If a QuantilePG object is used for smoothing, only the weight, frequencies and levels.1 and levels.2 parameters are used; all others are ignored. In this case the default values for the levels are the levels of the QuantilePG used for smoothing. Any subset of the levels available there can be chosen.

Usage

smoothedPG(object, frequencies = 2 * pi/length(object) * 0:(length(object) -
  1), levels.1 = 0.5, levels.2 = levels.1, isRankBased = TRUE,
  type = c("clipped", "qr"), type.boot = c("none", "mbb"),
  method = c("br", "fn", "pfn", "fnc", "lasso", "scad"), parallel = FALSE,
  B = 0, l = 1, weight = kernelWeight())

Arguments

object
a time series (numeric, ts, or zoo object) from which to determine the smoothed periodogram; alternatively a QuantilePG object can be supplied.
isRankBased
If true the time series is first transformed to pseudo data [cf. FreqRep].
levels.1
A vector of length K1 containing the levels x1 at which the SmoothedPG is to be determined.
levels.2
A vector of length K2 containing the levels x2.
frequencies
A vector containing frequencies at which to determine the smoothed periodogram.
type
A flag to choose the type of the estimator. Can be either "clipped" or "qr". In the first case ClippedFT is used as a frequency representation, in the second case
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, where possible.
weight
Object of type Weight to be used for smoothing.

Value

  • Returns an instance of SmoothedPG.

Details

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.

Examples

Run this code
Y <- rnorm(64)
levels.1 <- c(0.25,0.5,0.75)
weight <- kernelWeight(W=W0)

# Version 1a of the constructor -- for numerics:
sPG.ft <- smoothedPG(Y, levels.1 = levels.1, weight = weight, type="clipped")
sPG.qr <- smoothedPG(Y, levels.1 = levels.1, weight = weight, type="qr")

# Version 1b of the constructor -- for ts objects:
sPG.ft <- smoothedPG(wheatprices, levels.1 = c(0.05,0.5,0.95), weight = weight)

# Version 1c of the constructor -- for zoo objects:
sPG.ft <- smoothedPG(sp500, levels.1 = c(0.05,0.5,0.95), weight = weight)

# Version 2 of the constructor:
qPG.ft <- quantilePG(Y, levels.1 = levels.1, type="clipped")
sPG.ft <- smoothedPG(qPG.ft, weight = weight)
qPG.qr <- quantilePG(Y, levels.1 = levels.1, type="qr")
sPG.qr <- smoothedPG(qPG.qr, weight = weight)

Run the code above in your browser using DataLab