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
is the distribution to be checked for compatibility, and
y is the
Graphical parameters may be given as arguments to
The stats function
is just the method for signature
In all title and axis label arguments, if
the following patterns are substituted:
- class of argument
- deparsed argument
- time/date-string when the plot was generated
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="">100),>
- object of class
"ANY"(stats-method) or of code
"UnivariateDistribution"; to be compared to
- object of class
"ANY"(stats-method) or of class
- numeric; number of quantiles at which to do the comparison.
- logical; shall line
y = xbe plotted in?
- logical; shall confidence lines be plotted?
- logical; shall pointwise confidence lines be plotted?
- logical; shall simultaneous confidence lines be plotted?
- logical; shall be plotted at all (inherited from
- further parameters for function
- width (in inches) of the graphics device opened
- height (in inches) of the graphics device opened
- logical: if
TRUE(for working with
Sweave) no extra device is opened and height/width are not set
- shall default partition in panels be used --- defaults to
- numeric; number of points to be used for confidence interval
- color for the identity line
- line type for the identity line
- line width for the identity line
- confidence level
- logical; shall pointwise CIs be determined with exact Binomial distribution?
- logical; shall simultaneous CIs be determined with exact kolmogorov distribution?
- logical; shall we use (shortest) asymmetric CIs?
- color for the pointwise CI
- line type for the pointwise CI
- line width for the pointwise CI
- symbol for points (for discrete mass points) in pointwise CI
- magnification factor for points (for discrete mass points) in pointwise CI
- color for the simultaneous CI
- line type for the simultaneous CI
- line width for the simultaneous CI
- symbol for points (for discrete mass points) in simultaneous CI
- magnification factor for points (for discrete mass points) in simultaneous CI
- magnification factor for the plotted symbols
- color for the plotted symbols
- jittering factor used for discrete distributions
- logical; shall we check if all
x-quantiles lie in
- logical; if preceding check
x-quantiles if not in
- logical; shall a legend be plotted?
- background color for the legend
- position for the legend
- magnification factor for the legend
- character to be prepended to legend text
- character to be appended to legend text
- nominal coverage probability
- logical; if
TRUEadditional output to debug confidence bounds.
- logical; if
TRUE(default) pattern substitution for titles and lables is used; otherwise no substitution is used.
signature(x = "ANY", y = "ANY"): function
qqplotfrom package stats.
signature(x = "UnivariateDistribution", y = "UnivariateDistribution"): produces a QQ plot for two univariate distributions.
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
- The x coordinates of the points that were/would be plotted
- The corresponding quantiles of the second distribution,
- A matrix with the lower and upper confidence bounds
- logical vector of length 2. (elements
qqplotfrom package stats, i.e., a list with components
yfor x and y coordinates of the plotted points; more specifically it contains
errare 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).
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
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)