Learn R Programming

RobAStBase (version 1.2.6)

qqplot: Methods for Function qqplot in Package `RobAStBase'

Description

We generalize function qqplot from package stats to be applicable to distribution and probability model objects. In this context, qqplot produces a QQ plot of data (argument x) against a (model) distribution. For arguments y of class RobModel, points at a high “distance” to the model are plotted smaller. For arguments y of class kStepEstimate, points at with low weight in the [p]IC are plotted bigger and their color gets faded out slowly. Graphical parameters may be given as arguments to qqplot.

Usage

qqplot(x, y, ...)
# S4 method for ANY,RobModel
qqplot(x, y,
   n = length(x), withIdLine = TRUE, withConf = TRUE,
   withConf.pw  = withConf,  withConf.sim = withConf,
    plot.it = TRUE, xlab = deparse(substitute(x)),
    ylab = deparse(substitute(y)), ..., distance = NormType(),
    n.adj = TRUE)
# S4 method for ANY,InfRobModel
qqplot(x, y, n = length(x), withIdLine = TRUE, 
withConf = TRUE, withConf.pw = withConf, withConf.sim = withConf,
  plot.it = TRUE, xlab = deparse(substitute(x)), ylab =
  deparse(substitute(y)), ..., cex.pts.fun = NULL, n.adj = TRUE)
# S4 method for ANY,kStepEstimate
qqplot(x, y,
   n = length(x), withIdLine = TRUE, withConf = TRUE,
   withConf.pw  = withConf,  withConf.sim = withConf,
    plot.it = TRUE, xlab = deparse(substitute(x)),
    ylab = deparse(substitute(y)), ...,
    exp.cex2.lbs = -.15,
    exp.cex2.pts = -.35,
    exp.fadcol.lbs = 1.85,
    exp.fadcol.pts = 1.85,
    bg = "white")

Value

As for function qqplot from package stats: a list with components

x

The x coordinates of the points that were/would be plotted

y

The corresponding quantiles of the second distribution, including NAs.

Arguments

x

data to be checked for compatibility with distribution/model y.

y

object of class "RobModel", of class "InfRobModel" or of class "kStepEstimate".

n

numeric; number of quantiles at which to do the comparison.

withIdLine

logical; shall line y = x be plotted in?

withConf

logical; shall confidence lines be plotted?

withConf.pw

logical; shall pointwise confidence lines be plotted?

withConf.sim

logical; shall simultaneous confidence lines be plotted?

plot.it

logical; shall be plotted at all (inherited from qqplot)?

xlab

x-label

ylab

y-label

...

further parameters for method qqplot with signature ANY,ProbFamily (see qqplot) or with function plot

cex.pts.fun

rescaling function for the size of the points to be plotted; either NULL (default), then log(1+abs(x)) is used, or a function which is then used.

n.adj

logical; shall sample size be adjusted for possible outliers according to radius of the corresponding neighborhood?

distance

a function mapping observations x to the positive reals; used to determine the size of the plotted points (the larger distance(x), the smaller the points are plotted.

exp.cex2.lbs

for objects kStepEstimate based on a [p]IC of class HampIC: exponent for the weights of this [p]IC used to magnify the labels.

exp.cex2.pts

for objects kStepEstimate based on a [p]IC of class HampIC: exponent for the weights of this [p]IC used to magnify the symbols.

exp.fadcol.lbs

for objects kStepEstimate based on a [p]IC of class HampIC: exponent for the weights of this [p]IC used to find out-fading colors.

exp.fadcol.pts

for objects kStepEstimate based on a [p]IC of class HampIC: exponent for the weights of this [p]IC used to find out-fading colors.

bg

background color to fade against

Author

Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de

Details

qqplot

signature(x = "ANY", y = "RobModel"): produces a QQ plot of a dataset x against the theoretical quantiles of distribution of robust model y.

qqplot

signature(x = "ANY", y = "InfRobModel"): produces a QQ plot of a dataset x against the theoretical quantiles of distribution of infinitesimally robust model y.

qqplot

signature(x = "ANY", y = "kStepEstimate"): produces a QQ plot of a dataset x against the theoretical quantiles of the model distribution of model at which the corresponding kStepEstimate y had been calibrated at. By default, if the [p]IC of the kStepEstimate is of class HampIC, i.e.; has a corresponding weight function, points (and, if with.lab==TRUE, labels) are scaled and faded according to this weight function. Corresponding arguments exp.cex2.pts and exp.fadcol.pts control this scaling and fading, respectively (and analogously exp.cex2.lbs and exp.fadcol.lbs for the labels). The choice of these arguments has to be done on a case-by-case basis. Positive exponents induce fading, magnification with increasing weight, for negative exponents the same is true for decreasing weight; higher (absolute) values increase the speed of fading / magnification.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

See Also

qqplot from package stats -- the standard QQ plot function, qqplot from package distr for comparisons of distributions, and qqplot from package distrMod (which is called intermediately by this method), as well as qqbounds, used by qqplot to produce confidence intervals.

Examples

Run this code
## \donttest to reduce check time
# \donttest{
qqplot(rnorm(40, mean = 15, sd = sqrt(30)), Chisq(df=15))
RobM <- InfRobModel(center = NormLocationFamily(mean=13,sd=sqrt(28)),
                    neighbor = ContNeighborhood(radius = 0.4))

x <- rnorm(20, mean = 15, sd = sqrt(30))
qqplot(x, RobM)
qqplot(x, RobM, alpha.CI=0.9, add.points.CI=FALSE)
# }
## further examples for ANY,kStepEstimator-method
## in example to roptest() in package ROptEst

Run the code above in your browser using DataLab