qqplot

0th

Percentile

Methods for Function qqplot in Package `distr'

We generalize function qqplot from package stats to be applicable to distribution objects. In this context, qqplot produces a QQ plot of two distributions, i.e.; argument x is the distribution to be checked for compatibility, and y is the model ($H0$-)distribution. Graphical parameters may be given as arguments to qqplot. The stats function is just the method for signature x=ANY,y=ANY. In all title and axis label arguments, if withSubst is TRUE, the following patterns are substituted:

"%C"
class of argument x

"%A"
deparsed argument x

"%D"
time/date-string when the plot was generated

Keywords
hplot, distribution
Usage
qqplot(x, y, ...) "qqplot"(x, y, n = 30, withIdLine = TRUE, withConf = TRUE, withConf.pw  = withConf, withConf.sim = withConf, plot.it = TRUE, xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), ..., width = 10, height = 5.5, withSweave = getdistrOption("withSweave"), mfColRow = TRUE, n.CI = n, col.IdL = "red", lty.IdL = 2, lwd.IdL = 2, alpha.CI = .95, exact.pCI = (n<100), exact.sci =" (n<100)," nosym.pci =" FALSE," col.pci =" "orange"," lty.pci =" 3," lwd.pci =" 2," pch.pci =" par("pch")," cex.pci =" par("cex")," col.sci =" "tomato2"," lty.sci =" 4," lwd.sci =" 2," pch.sci =" par("pch")," cex.sci =" par("cex")," cex.pch =" par("cex")," col.pch =" par("col")," jit.fac =" 0," check.notinsupport =" TRUE," col.notinsupport =" "red"," with.legend =" TRUE," legend.bg =" "white"," legend.pos =" "topleft"," legend.cex =" 0.8," legend.pref =" ""," legend.postf =" ""," legend.alpha =" alpha.CI," debug =" FALSE," withsubst =" TRUE)" "qqplot"(x,="" y,="" plot.it =" TRUE," xlab =" deparse(substitute(x))," ylab =" deparse(substitute(y))," ...)<="" div="">
Arguments
x
object of class "ANY" (stats-method) or of code "UnivariateDistribution"; to be compared to y.
y
object of class "ANY" (stats-method) or of class "UnivariateDistribution".
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 function plot
width
width (in inches) of the graphics device opened
height
height (in inches) of the graphics device opened
withSweave
logical: if TRUE (for working with Sweave) no extra device is opened and height/width are not set
mfColRow
shall default partition in panels be used --- defaults to TRUE
n.CI
numeric; number of points to be used for confidence interval
col.IdL
color for the identity line
lty.IdL
line type for the identity line
lwd.IdL
line width for the identity line
alpha.CI
confidence level
exact.pCI
logical; shall pointwise CIs be determined with exact Binomial distribution?
exact.sCI
logical; shall simultaneous CIs be determined with exact kolmogorov distribution?
nosym.pCI
logical; shall we use (shortest) asymmetric CIs?
col.pCI
color for the pointwise CI
lty.pCI
line type for the pointwise CI
lwd.pCI
line width for the pointwise CI
pch.pCI
symbol for points (for discrete mass points) in pointwise CI
cex.pCI
magnification factor for points (for discrete mass points) in pointwise CI
col.sCI
color for the simultaneous CI
lty.sCI
line type for the simultaneous CI
lwd.sCI
line width for the simultaneous CI
pch.sCI
symbol for points (for discrete mass points) in simultaneous CI
cex.sCI
magnification factor for points (for discrete mass points) in simultaneous CI
cex.pch
magnification factor for the plotted symbols
col.pch
color for the plotted symbols
jit.fac
jittering factor used for discrete distributions
check.NotInSupport
logical; shall we check if all x-quantiles lie in support(y)?
col.NotInSupport
logical; if preceding check TRUE color of x-quantiles if not in support(y)
with.legend
logical; shall a legend be plotted?
legend.bg
background color for the legend
legend.pos
position for the legend
legend.cex
magnification factor for the legend
legend.pref
character to be prepended to legend text
legend.postf
character to be appended to legend text
legend.alpha
nominal coverage probability
debug
logical; if TRUE additional output to debug confidence bounds.
withSubst
logical; if TRUE (default) pattern substitution for titles and lables is used; otherwise no substitution is used.
Details

qqplot
signature(x = "ANY", y = "ANY"): function qqplot from package stats.

qqplot
signature(x = "UnivariateDistribution", y = "UnivariateDistribution"): produces a QQ plot for two univariate distributions.

Value

A list of elements containing the information needed to compute the respective QQ plot, in particular it extends the elements of the return value of function qqplot from package stats, i.e., a list with components x and y for x and y coordinates of the plotted points; more specifically it contains
x
The x coordinates of the points that were/would be plotted
y
The corresponding quantiles of the second distribution, including NAs.
crit
A matrix with the lower and upper confidence bounds (computed by qqbounds).
err
logical vector of length 2.
(elements crit and err are taken from the return value(s) of qqbounds). The return value allows to recover all information used to produce the plot for later use in enhanced graphics (e.g. with ggplot).

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 and qqbounds, used by qqplot to produce confidence intervals.

Aliases
  • qqplot
  • qqplot-methods
  • qqplot,ANY,ANY-method
  • qqplot,UnivariateDistribution,UnivariateDistribution-method
Examples
qqplot(Norm(15,sqrt(30)), Chisq(df=15))
## some discrete Distributions:
P <- Pois(5)
B <- Binom(size=2000,prob=5/2000)
qqplot(B,P)
## Not run: 
# ## takes too much time for R CMD check --as-cran
# qqplot(B,P, nosym.pCI=TRUE)
# ## End(Not run)
## some Lebesgue-Decomposed distributions:
mylist <- UnivarLebDecDistribution(discretePart=Binom(3,.3), acPart=Norm(2,2),
               acWeight=11/20)
mylist2 <- mylist+0.1
qqplot(mylist,mylist2)
qqplot(mylist,mylist2,exact.pCI=FALSE,exact.sCI=FALSE)
## Not run: 
# ## takes too much time for R CMD check --as-cran
# qqplot(mylist,mylist2,nosym.pCI=TRUE)
# ## some ac. distribution with a gap
# mylist3 <- UnivarMixingDistribution(Unif(0,0.3),Unif(0.6,1),mixCoeff=c(0.8,0.2))
# gaps(mylist3)
# mylist4 <- UnivarMixingDistribution(Unif(0,0.3),Unif(0.6,1),mixCoeff=c(0.6,0.4))
# qqplot(mylist3,mylist4)
# qqplot(mylist3,mylist4,nosym.pCI=TRUE)
# ## End(Not run)
Documentation reproduced from package distr, version 2.6, License: LGPL-3

Community examples

Looks like there are no examples yet.