An Alternate EDA Graphical Summary
Plots a simple four panel graphical distributional summary for a data set, comprising a histogram, a cumulative normal percentage probability (CPP) plot, an empirical cumulative distribution function (ECDF), and a log-log concentration-number (C-N) plot for multifractality. Optionally the EDA graphics may be plotted with logarithmic (base 10) scaling, in which case all four plots have identical x-axis scaling.
shape.alt(xx, xlab = deparse(substitute(xx)), log = FALSE, xlim = NULL, nclass = NULL, ifnright = TRUE, ifrev = FALSE, colr = 8, ...)
xx |
name of the variable to be plotted. |
xlab |
by default the character string for |
log |
to display the data with logarithmic (x-axis) scaling, set |
xlim |
is determined by |
nclass |
the default procedure for preparing the histogram depends on sample size. Where N <= 500 the Scott (1979) rule is used, and when N > 500 the Freedman-Diaconis (1981) rule; both these rules are resistant to the presence of outliers, and usually provide informative histograms. Alternately, the user may define the histogram binning by setting |
ifnright |
controls where the sample size is plotted in the histogram display, by default this in the upper right corner of the plot. If the data distribution is such that the upper left corner would be preferable, set |
ifrev |
by default the empirical C-N function is plotted from highest value to lowest, |
colr |
by default the histogram and Tukey boxplot, or box-and-whisker plot, are infilled in grey, |
... |
further arguments to be passed to methods. For example, the size of the axis scale annotation can be changed by setting |
A histogram is displayed upper left, and an ECDF is displayed below it (lower left). To the right of the histogram a cumulative normal percentage probability (CPP) plot is displayed. Below it (lower right) a log-log C-N plot is displayed to highlight any multifractality in the data, which will be revealed as 'lines' of data points with different slopes. When log scaling is selected the x-axis scaling is identical in all four plots.
Any less than detection limit values represented by negative values, or zeros or other numeric codes representing blanks in the data, must be removed prior to executing this function, see ltdl.fix.df
.
Any NA
s in the data vector are removed prior to displaying the plots.
If the default selection for xlim
is inappropriate it can be set, e.g., xlim = c(0, 200)
or c(2, 200)
, the latter being appropriate for a logarithmcally scaled plot, i.e. log = TRUE
. If the defined limits lie within the observed data range truncated plots will be displayed. If this occurs the number of data points omitted is displayed below the total number of observations in the various panels.
If it is desired to prepare a display of data falling within a defined part of the actual data range, then either a data subset can be prepared externally using the appropriate R syntax, or xx
may be defined in the function call as, for example, Cu[Cu < some.value]
which would remove the influence of one or more outliers having values greater than some.value
. In this case the number of data values displayed will be the number that are <some.value
.
In some R installations the generation of multi-panel displays and the use of function eqscplot from package MASS causes warning messages related to graphics parameters to be displayed on the current device. These may be suppressed by entering options(warn = -1)
on the R command line, or that line may be included in a ‘first’ function prepared by the user that loads the ‘rgr’ package, etc.
For summary statistics displays to complement the graphics see, gx.summary1
, gx.summary2
and inset
.
Robert G. Garrett
Venables, W.N. and Ripley, B.D., 2001. Modern Applied Statistsis with S-Plus, 3rd Edition, Springer, 501 p. See pp. 119 for a description of histogram bin selection computations.
## Make test data available data(kola.o) attach(kola.o) ## Generates an initial display to have a first look at the data and ## decide how best to proceed shape.alt(Cu) ## Provides a more appropriate initial display and indicates the ## quartiles shape.alt(Cu, xlab = "Cu (mg/kg) in <2 mm O-horizon soil", log = TRUE, ifqs = TRUE) ## Causes the C-N plot to be cumulated in reverse order. This will reveal ## any multifractal properties of the data at lower concentrations shape.alt(Cu, xlab = "Cu (mg/kg) in <2 mm O-horizon soil", log = TRUE, ifrev = TRUE) ## Detach test data detach(kola.o)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.