qqPlotGestalt {EnvStats} | R Documentation |
Develop Gestalt of Q-Q Plots for Specific Distributions
Description
Produce a series of quantile-quantile (Q-Q) plots (also called probability plots) or Tukey mean-difference Q-Q plots for a user-specified distribution.
Usage
qqPlotGestalt(distribution = "norm", param.list = list(mean = 0, sd = 1),
estimate.params = FALSE, est.arg.list = NULL, sample.size = 10, num.pages = 2,
num.plots.per.page = 4, nrow = ceiling(num.plots.per.page/2), plot.type = "Q-Q",
plot.pos.con = switch(dist.abb, norm = , lnorm = , lnormAlt = , lnorm3 = 0.375,
evd = 0.44, 0.4), equal.axes = (qq.line.type == "0-1" || estimate.params),
margin.title = NULL, add.line = FALSE, qq.line.type = "least squares",
duplicate.points.method = "standard", points.col = 1, line.col = 1,
line.lwd = par("cex"), line.lty = 1, digits = .Options$digits,
same.window = TRUE, ask = same.window & num.pages > 1,
mfrow = c(nrow, num.plots.per.page/nrow),
mar = c(4, 4, 1, 1) + 0.1, oma = c(0, 0, 7, 0), mgp = c(2, 0.5, 0), ...,
main = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL)
Arguments
distribution |
a character string denoting the distribution abbreviation. The default value is
|
param.list |
a list with values for the parameters of the distribution. The default value is
|
estimate.params |
a logical scalar indicating whether to compute quantiles based on estimating the
distribution parameters ( |
est.arg.list |
a list whose components are optional arguments associated with the function used
to estimate the parameters of the assumed distribution (see the help file
Estimating Distribution Parameters).
For example, all functions used to estimate distribution parameters have an optional argument
called |
sample.size |
numeric scalar indicating the number of observations to generate for each Q-Q plot.
The default value is |
num.pages |
numeric scalar indicating the number of pages of plots to generate.
The default value is |
num.plots.per.page |
numeric scalar indicating the number of plots per page.
The default value is |
nrow |
numeric scalar indicating the number of rows of plots on each page.
The default value is the smallest integer greater than or equal to
|
plot.type |
a character string denoting the kind of plot. Possible values are |
plot.pos.con |
numeric scalar between 0 and 1 containing the value of the plotting position constant.
The default value of |
equal.axes |
logical scalar indicating whether to use the same range on the |
margin.title |
character string indicating the title printed in the top margin on each page of plots. The default value indicates the kind of Q-Q plot, the probability distribution, the sample size, and the estimation method used (if any). |
add.line |
logical scalar indicating whether to add a line to the plot.
If |
qq.line.type |
character string determining what kind of line to add to the Q-Q plot.
Possible values are |
duplicate.points.method |
character string denoting how to plot points with duplicate |
points.col |
numeric scalar or character string determining the color of the points in the plot.
The default value is |
line.col |
numeric scalar or character string determining the color of the line in the plot.
The default value is |
line.lwd |
numeric scalar determining the width of the line in the plot. The default value is
|
line.lty |
a numeric scalar determining the line type of the line in the plot. The default value is
|
digits |
a scalar indicating how many significant digits to print for the distribution
parameters. The default value is |
same.window |
logical scalar indicating whether to produce all plots in the same graphics
window ( |
ask |
logical scalar supplied to the function |
mfrow , mar , oma , mgp , main , xlab , ylab , xlim , ylim , ... |
additional graphical parameters (see |
Details
The function qqPlotGestalt
allows the user to display several Q-Q plots or
Tukey mean-difference Q-Q plots for a specified probability distribution.
The distribution is specified with the arguments distribution
and
param.list
. By default, normal (Gaussian)
Q-Q plots are produced.
If estimate.params=FALSE
(the default), the theoretical quantiles on the
x
-axis are computed using the known distribution parameters specified in
param.list
. If estimate.params=TRUE
, the distribution parameters
are estimated based on the sample, and these estimated parameters are then used
to compute the theoretical quantiles. For distributions that can be specified
by a location and scale parameter (e.g., Normal, Logistic, extreme value, etc.),
the value of estimate.params
will not affect the general shape of the
plot, only the values recorded on the x
-axis. For distributions that cannot
be specified by a location and scale parameter (e.g., exponential, gamma, etc.), it
is recommended that estimate.params
be set to TRUE
since in pracitice
the values of the distribution parameters are not known but must be estimated from
the sample.
The purpose of qqPlotGestalt
is to allow the user to build-up a visual
memory of “typical” Q-Q plots. A Q-Q plot is a graphical tool that allows
you to assess how well a particular set of observations fit a particular
probability distribution. The value of this tool depends on the user having an
internal reference set of Q-Q plots with which to compare the current Q-Q plot.
See the help file for qqPlot
for more information.
Value
The NULL
value is returned.
Author(s)
Steven P. Millard (EnvStats@ProbStatInfo.com)
References
See the REFERENCES section for qqPlot
.
See Also
Examples
# Look at eight typical normal (Gaussian) Q-Q plots for random samples
# of size 10 from a N(0,1) distribution
# Are you surprised by the variability in the plots?
#
# (Note: you must use set.seed if you want to reproduce the exact
# same plots more than once.)
set.seed(298)
qqPlotGestalt(same.window = FALSE)
# Add lines to these same Q-Q plots
#----------------------------------
set.seed(298)
qqPlotGestalt(same.window = FALSE, add.line = TRUE)
# Add lines to different Q-Q plots
#---------------------------------
qqPlotGestalt(same.window = FALSE, add.line = TRUE)
## Not run:
# Look at 4 sets of plots all in the same graphics window
#--------------------------------------------------------
qqPlotGestalt(add.line = TRUE, num.pages = 4)
## End(Not run)
#==========
# Look at Q-Q plots for a gamma distribution
#-------------------------------------------
qqPlotGestalt(dist = "gammaAlt",
param.list = list(mean = 10, cv = 1),
estimate.params = TRUE, num.pages = 3,
same.window = FALSE, add.line = TRUE)
# Look at Tukey Mean Difference Q-Q plots
# for a gamma distribution
#----------------------------------------
qqPlotGestalt(dist = "gammaAlt",
param.list = list(mean = 10, cv = 1),
estimate.params = TRUE, num.pages = 3,
plot.type = "Tukey", same.window = FALSE, add.line = TRUE)
#==========
# Clean up
#---------
graphics.off()