qqplot | R Documentation |
We generalize function qqplot
from package stats to
be applicable to distribution and probability model objects, as well as
to estimate objects. In this context,
qqplot
produces a QQ plot of data (argument x
) against
a (model) distribution. If the second argument is of class 'Estimate'
,
qqplot
looks at the estimate.call
-slot and checks whether
it can use an argument ParamFamily
to conclude on the model
distribution. Graphical parameters may be given as arguments to
qqplot
.
In all title and 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 signature 'ANY,UnivariateDistribution'
qqplot(x,y,
n = length(x), withIdLine = TRUE,
withConf = TRUE, withConf.pw = withConf, withConf.sim = withConf,
plot.it = TRUE, datax = FALSE, xlab = deparse(substitute(x)),
ylab = deparse(substitute(y)),
..., width = 10, height = 5.5, withSweave = getdistrOption("withSweave"),
mfColRow = TRUE, n.CI = n, with.lab = FALSE, lab.pts = NULL, which.lbs = NULL,
which.Order = NULL, which.nonlbs = NULL, attr.pre = FALSE, order.traf = NULL,
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"), added.points.CI = TRUE,
cex.pch = par("cex"), col.pch = par("col"),
cex.pts = 1, col.pts = par("col"), pch.pts = 19,
cex.npts = 1, col.npts = grey(.5), pch.npts = 20,
cex.lbs = par("cex"), col.lbs = par("col"), adj.lbs = par("adj"),
alpha.trsp = NA, jit.fac = 0, jit.tol = .Machine$double.eps,
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)
## S4 method for signature 'ANY,ProbFamily'
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)), ...)
## S4 method for signature 'ANY,Estimate'
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)), ...)
x |
data to be checked for compatibility with distribution/model |
y |
object of class |
n |
numeric; assumed sample size (by default length of |
withIdLine |
logical; shall line |
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
|
datax |
logical; shall data be plotted on x-axis? |
xlab |
x-label |
ylab |
y-label |
... |
further parameters for method |
width |
width (in inches) of the graphics device opened |
height |
height (in inches) of the graphics device opened |
withSweave |
logical: if |
mfColRow |
shall default partition in panels be used — defaults to |
n.CI |
numeric; number of points to be used for confidence interval |
with.lab |
logical; shall observation labels be plotted in? |
lab.pts |
character or |
attr.pre |
logical; do graphical attributes for plotted data refer
to indices prior ( |
which.lbs |
integer or |
which.Order |
integer or |
which.nonlbs |
indices of the observations which should be plotted but
not labelled; either an integer vector with the indices of the observations
to be plotted into graph or |
order.traf |
function or |
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 |
added.points.CI |
logical; should CIs be plotted through additional points (and not only through data points)? |
cex.pch |
magnification factor for the plotted symbols (for backward
compatibility); it is ignored once |
col.pch |
color for the plotted symbols (for backward compatibility); it is
ignored once |
cex.pts |
size of the points of the second argument plotted, can be a vector;
if argument |
col.pts |
color of the points of the second argument plotted, can
be a vector as in |
pch.pts |
symbol of the points of the second argument plotted, can
be a vector as in |
col.npts |
color of the non-labelled points of the |
pch.npts |
symbol of the non-labelled points of the |
cex.npts |
size of the non-labelled points of the |
cex.lbs |
magnification factor for the plotted observation labels |
col.lbs |
color for the plotted observation labels |
adj.lbs |
adj parameter for the plotted observation labels |
alpha.trsp |
alpha transparency to be added ex post to colors
|
jit.fac |
jittering factor used for discrete distributions. |
jit.tol |
threshold for jittering: if distance between points is smaller
than |
check.NotInSupport |
logical; shall we check if all |
col.NotInSupport |
logical; if preceding check |
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 |
withSubst |
logical; if |
signature(x = "ANY", y = "UnivariateDistribution")
:
produces a QQ plot of a dataset x
against the theoretical
quantiles of distribution y
.
signature(x = "ANY", y = "ProbFamily")
:
produces a QQ plot of a dataset x
against the theoretical
quantiles of the model distribution of model y
. Passed through
the ...
argument, all arguments valid for
signature(x = "ANY", y = "UnivariateDistribution")
are also valid for this signature.
signature(x = "ANY", y = "Estimate")
:
produces a QQ plot of a dataset x
against the theoretical
quantiles of the model distribution of the model that can be reconstructed
from the estimator y
; more specifically, it tries to get hand at the
argument 'ParamFamily'
of the esimator's call; if this is available,
internally this model is shifted to the estimated parameter by a call to
modifyModel
, and then this shifted model is used in a call to the
(x = "ANY", y = "UnivariateDistribution")
-method. Passed through
the ...
argument, all arguments valid for
signature(x = "ANY", y = "UnivariateDistribution")
are also valid for this signature.
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 |
crit |
A matrix with the lower and upper confidence bounds
(computed by |
err |
logical vector of length 2. |
(elements crit
and err
are taken from the return
value(s) of qqbounds
).
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de
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, qqplot
from package distr for
comparisons of distributions, and
qqbounds
, used by qqplot
to produce confidence
intervals.
set.seed(123)
x <- rnorm(40,mean=15,sd=30)
qqplot(x, Chisq(df=15))
NF <- NormLocationScaleFamily(mean=15, sd=30)
qqplot(x, NF, with.lab=TRUE, which.Order=1:5, cex.lbs=1.3)
mlE <- MLEstimator(x, NF)
qqplot(x, mlE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.