
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 (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
qqplot(x, y, ...)
# S4 method for UnivariateDistribution,UnivariateDistribution
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
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
The x coordinates of the points that were/would be plotted
The corresponding quantiles of the second distribution,
including NA
s.
A matrix with the lower and upper confidence bounds
(computed by qqbounds
).
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).
object of class "ANY"
(stats-method) or
of code "UnivariateDistribution"
; to be compared to y
.
object of class "ANY"
(stats-method) or
of class "UnivariateDistribution"
.
numeric; number of quantiles at which to do the comparison.
logical; shall line y = x
be 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 qqplot
)?
x-label
y-label
further parameters for function plot
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 TRUE
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 support(y)
?
logical; if preceding check TRUE
color of x
-quantiles if not in support(y)
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 TRUE
additional output to debug confidence bounds.
logical; if TRUE
(default) pattern substitution for
titles and lables is used; otherwise no substitution is used.
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de
signature(x = "ANY", y = "ANY")
: function qqplot
from
package stats.
signature(x = "UnivariateDistribution", y = "UnivariateDistribution")
:
produces a QQ plot for two univariate distributions.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
qqplot
from package stats -- the standard QQ plot
function and
qqbounds
, used by qqplot
to produce confidence
intervals.
## IGNORE_RDIFF_BEGIN
qqplot(Norm(15,sqrt(30)), Chisq(df=15))
## some discrete Distributions:
P <- Pois(5)
B <- Binom(size=2000,prob=5/2000)
qqplot(B,P)
## IGNORE_RDIFF_END
# \donttest{
## takes too much time for R CMD check --as-cran
qqplot(B,P, nosym.pCI=TRUE)
# }
## some Lebesgue-Decomposed distributions:
mylist <- UnivarLebDecDistribution(discretePart=Binom(3,.3), acPart=Norm(2,2),
acWeight=11/20)
mylist2 <- mylist+0.1
## IGNORE_RDIFF_BEGIN
qqplot(mylist,mylist2)
qqplot(mylist,mylist2,exact.pCI=FALSE,exact.sCI=FALSE)
## IGNORE_RDIFF_END
# \donttest{
## 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)
# }
Run the code above in your browser using DataLab