infoPlot {RobAStBase} | R Documentation |
Plot absolute and relative information
Description
Plot absolute and relative information of influence curves.
Usage
infoPlot(object, ...)
## S4 method for signature 'IC'
infoPlot(object, data = NULL,
..., withSweave = getdistrOption("withSweave"),
col = par("col"), lwd = par("lwd"), lty,
colI = grey(0.5), lwdI = 0.7*par("lwd"), ltyI = "dotted",
main = FALSE, inner = TRUE, sub = FALSE,
col.inner = par("col.main"), cex.inner = 0.8,
bmar = par("mar")[1], tmar = par("mar")[3],
with.automatic.grid = TRUE,
with.legend = TRUE, legend = NULL, legend.bg = "white",
legend.location = "bottomright", legend.cex = 0.8,
x.vec = NULL, scaleX = FALSE, scaleX.fct, scaleX.inv,
scaleY = FALSE, scaleY.fct = pnorm, scaleY.inv=qnorm,
scaleN = 9, x.ticks = NULL, y.ticks = NULL,
mfColRow = TRUE, to.draw.arg = NULL,
cex.pts = 1, cex.pts.fun = NULL, col.pts = par("col"),
pch.pts = 19,
cex.npts = 1, cex.npts.fun = NULL, col.npts = grey(.5),
pch.npts = 20,
jitter.fac = 1, with.lab = FALSE, cex.lbs = 1, adj.lbs = c(0, 0),
col.lbs = col.pts, lab.pts = NULL, lab.font = NULL, alpha.trsp = NA,
which.lbs = NULL, which.Order = NULL, which.nonlbs = NULL,
attr.pre = FALSE, return.Order = FALSE,
ylab.abs = "absolute information",
ylab.rel= "relative information",
withSubst = TRUE)
Arguments
object |
object of class |
data |
optional data argument — for plotting observations into the plot; |
withSweave |
logical: if |
main |
logical: is a main title to be used? or |
inner |
logical: do panels have their own titles? or |
sub |
logical: is a sub-title to be used? or |
tmar |
top margin – useful for non-standard main title sizes; may be a vector with individual values for each of the panels to be plotted. |
bmar |
bottom margin – useful for non-standard sub title sizes; may be a vector with individual values for each of the panels to be plotted. |
col |
color of IC in argument |
lwd |
linewidth of IC in argument |
lty |
line-type of IC in argument |
colI |
color of the classically optimal IC. |
lwdI |
linewidth of the classically optimal IC. |
ltyI |
line-type of the classically optimal IC. |
cex.inner |
magnification to be used for inner titles relative
to the current setting of |
col.inner |
character or integer code; color for the inner title |
with.automatic.grid |
logical; should a grid be plotted alongside
with the ticks of the axes, automatically? If |
with.legend |
logical; shall a legend be plotted? |
legend |
either |
legend.location |
a valid argument |
legend.bg |
background color for the legend |
legend.cex |
magnification factor for the legend |
x.vec |
a numeric vector of grid points to evaluate the influence curve;
by default, |
scaleX |
logical; shall X-axis be rescaled (by default according to the cdf of the underlying distribution)? |
scaleY |
logical; shall Y-axis be rescaled for abs.info-plot (by default according to a probit scale)? |
scaleX.fct |
an isotone, vectorized function mapping the domain of the IC
to [0,1]; if |
scaleX.inv |
the inverse function to |
scaleY.fct |
an isotone, vectorized function mapping the
range of the norm of the IC to [0,1]; defaulting
to the cdf of |
scaleY.inv |
an isotone, vectorized function mapping [0,1] into the range
of the norm of the IC; defaulting to the quantile function
of |
scaleN |
integer; defaults to 9; on rescaled axes, number of x and y ticks if drawn automatically; |
x.ticks |
numeric; defaults to NULL; (then ticks are chosen automatically); if non-NULL, user-given x-ticks (on original scale); |
y.ticks |
numeric; defaults to NULL; (then ticks are chosen automatically); if non-NULL, user-given y-ticks (on original scale); can be a list with one (numeric or NULL) item per panel |
mfColRow |
shall default partition in panels be used — defaults to |
to.draw.arg |
Either |
withSubst |
logical; if |
col.pts |
color of the points of the |
pch.pts |
symbol of the points of the |
cex.pts |
size of the points of the |
cex.pts.fun |
rescaling function for the size of the points to be plotted;
either |
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.npts.fun |
rescaling function for the size of the non-labelled points
to be plotted; either |
attr.pre |
logical; do graphical attributes for plotted data refer
to indices prior ( |
with.lab |
logical; shall labels be plotted to the observations?
(may be a vector of length 2, see |
cex.lbs |
size of the labels; can be vectorized to an array
of dim nlbs x 2 x npnl where npnl is the number of plotted
panels and nlbs the number of plotted labels; if it is
a vector, it is recylced in order labels then ICs
[arg |
col.lbs |
color of the labels; can be vectorized to a matrix
of dim nlbs x 2 as |
adj.lbs |
adjustment of the labels; can be vectorized to an array
of dim 2 x 2 x npnl matrix, npnl the number of plotted panels;
if it is a vector, it is recycled in order (x,y)-coords then ICs
[arg |
lab.pts |
character or NULL; labels to be plotted to the observations;
can be a vector of length |
lab.font |
font to be used for labels; (may be a vector of length 2,
see |
alpha.trsp |
alpha transparency to be added ex post to colors
|
jitter.fac |
jittering factor used in case of a |
which.lbs |
either an integer vector with the indices of the observations
to be plotted into graph or |
which.Order |
we order the observations (descending) according to the norm given by
|
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 |
return.Order |
logical; if |
ylab.abs |
character; label to be used for y-axis in absolute information panel |
ylab.rel |
character; label to be used for y-axis in relative information panel |
... |
further parameters for |
Details
Absolute information is defined as the square of the length
of an IC. The relative information is defined as the
absolute information of one component with respect to the
absolute information of the whole IC; confer Section 8.1
of Kohl (2005).
Any parameters of plot.default
may be passed on to this particular
plot
method.
For main-, inner, and subtitles given as arguments main
,
inner
, and sub
, top and bottom margins are enlarged to 5 resp.
6 by default but may also be specified by tmar
/ bmar
arguments.
If main
/ inner
/ sub
are
logical then if the respective argument is FALSE
nothing is done/plotted,
but if it is TRUE
, we use a default main title taking up the calling
arguments in case of main
, default inner titles taking up the
class and (named) parameter slots of arguments in case of inner
,
and a "generated on <data>"-tag in case of sub
.
Of course, if main
/ inner
/ sub
are character
, this
is used for the title; in case of inner
it is then checked whether it
has correct length. If argument withSubst
is TRUE
, in all title
and axis lable arguments, the following patterns are substituted:
"%C"
class of argument
object
"%A"
deparsed argument
object
"%D"
time/date-string when the plot was generated
If argument ...
contains argument ylim
, this may either be
as in plot.default
(i.e. a vector of length 2) or a vector of
length 2*(number of plotted dimensions + e), where e is 1 or 0 depending
on whether absolute information is plotted or not;
in the case of longer length,
if e is 1, the first two elements are the values for ylim
in panel "Abs", while the last 2*(number of plotted dimensions)
are the values for ylim
for the plotted dimensions of the IC,
one pair for each dimension.
Similarly, if argument ...
contains arguments xaxt
or
yaxt
, these may be vectorized, with one value for each of the panels
to be plotted. This is useful for stacking panels over each other, using
a common x-axis (see example below).
The ...
argument may also contain an argument withbox
which
if TRUE
warrants that even if xaxt
and yaxt
both are
FALSE
, a box is drawn around the respective panel.
In addition, argument ...
may contain arguments panel.first
,
panel.last
, i.e., hook expressions to be evaluated at the very beginning
and at the very end of each panel (within the then valid coordinates).
To be able to use these hooks for each panel individually, they may also be
lists of expressions (of the same length as the number of panels and
run through in the same order as the panels).
Value
An S3 object of class c("plotInfo","DiagnInfo")
, i.e., a list
containing the information needed to produce the
respective plot, which at a later stage could be used by different
graphic engines (like, e.g. ggplot
) to produce the plot
in a different framework. A more detailed description will follow in
a subsequent version.
Author(s)
Matthias Kohl Matthias.Kohl@stamats.de
References
Kohl, M. (2005) Numerical Contributions to the Asymptotic Theory of Robustness. Bayreuth: Dissertation.
See Also
Examples
N <- NormLocationScaleFamily(mean=0, sd=1)
IC1 <- optIC(model = N, risk = asCov())
infoPlot(IC1)
## don't run to reduce check time on CRAN
## selection of subpanels for plotting
par(mfrow=c(1,2))
infoPlot(IC1, mfColRow = FALSE, to.draw.arg=c("Abs","sd"))
infoPlot(IC1, mfColRow = FALSE, to.draw.arg=c("Abs","sd"), log="y")
infoPlot(IC1, mfColRow = FALSE, to.draw.arg=c("Abs","mean"),
panel.first= grid(), ylim = c(0,4), xlim = c(-6,6))
infoPlot(IC1, mfColRow = FALSE, to.draw.arg=c("Abs","mean"),
panel.first= grid(), ylim = c(0,4,-3,3), xlim = c(-6,6))
par(mfrow=c(1,3))
infoPlot(IC1, mfColRow = FALSE, panel.first= grid(),
ylim = c(0,4,0,.3,0,.8), xlim=c(-6,6))
par(mfrow=c(1,1))
data <- r(N)(20)
par(mfrow=c(1,3))
infoPlot(IC1, data=data, mfColRow = FALSE, panel.first= grid(),
with.lab = TRUE, cex.pts=2,
which.lbs = c(1:4,15:20), which.Order = 1:6,
return.Order = TRUE)
infoPlot(IC1, data=data[1:10], mfColRow = FALSE, panel.first= grid(),
with.lab = TRUE, cex.pts=0.7)
par(mfrow=c(1,1))
ICr <- makeIC(list(function(x)sign(x),function(x)sign(abs(x)-qnorm(.75))),N)
data <- r(N)(600)
data.c <- c(data, 1000*data[1:30])
par(mfrow=c(3,1))
infoPlot(ICr, data=data.c, tmar=c(4.1,0,0), bmar=c(0,0,4.1),
xaxt=c("n","n","s"), mfColRow = FALSE, panel.first= grid(),
cex.pts=c(.9,.9), alpha.trsp=20, lwd=2, lwdI=1.5, col=3,
col.pts=c(3,2), colI=2, pch.pts=c(20,20), inner=FALSE,
scaleX = TRUE, scaleX.fct=pnorm, scaleX.inv=qnorm,
scaleY=TRUE, scaleY.fct=function(x) pchisq(x,df=1),
scaleY.inv=function(x)qchisq(x,df=1),legend.cex = 1.0)