Function to plot 3D graphics or image and/or contour plots for bivariate effects/functions,
typically used for objects of class "sm.bayesx"
and "geo.bayesx"
returned from
function bayesx
and read.bayesx.output
.
plot3d(x, residuals = FALSE, col.surface = NULL,
ncol = 99L, swap = FALSE, col.residuals = NULL, col.contour = NULL,
c.select = NULL, grid = 30L, image = FALSE, contour = FALSE,
legend = TRUE, cex.legend = 1, breaks = NULL, range = NULL,
digits = 2L, d.persp = 1L, r.persp = sqrt(3), outscale = 0,
data = NULL, sep = "", shift = NULL, trans = NULL,
type = "interp", linear = FALSE, extrap = FALSE,
k = 40, ...)
a matrix or data frame, containing the covariates for which the effect should be plotted
in the first and second column and at least a third column containing the effect, typically
the structure for bivariate functions returned within bayesx
and
read.bayesx.output
model term objects is used, also see
fitted.bayesx
. Another possibility is to specify the plot via a formula
,
e.g. for simple plotting of bivariate surfaces z ~ x + y
, also see the example.
x
may also be a character file path to the data to be used for plotting.
if set to TRUE
, partial residuals may also be plotted if available.
the color of the surface, may also be a function, e.g.
col.surface = heat.colors
.
the number of different colors that should be generated, if col.surface
is a
function.
if set to TRUE
colors will be represented in reverse order.
the color of the partial residuals, or if contour = TRUE
the color of the
contour lines.
the color of the contour lines.
integer
vector of maximum length of columns of x
, selects the
columns of the resulting data matrix that should be used for plotting. E.g. if x
has 5
columns, then c.select = c(1, 2, 5)
will select column 1, 2 and 5 for plotting.
If c.select = 95
or c.select = 80
, function plot3d
will search for the
corresponding columns to plot a 95\(\%\) or 80\(\%\) confidence surfaces respectively. Note
that if e.g. c.select = c(1, 2)
, plot3d
will use columns 1 + 2 and 2 + 2 for
plotting.
the grid size of the surface(s).
if set to TRUE
, an image.plot
is drawn.
if set to TRUE
, a contour
plot is drawn.
if image = TRUE
an additional legend may be added to the plot.
the expansion factor for the legend text, see text
.
a set of breakpoints for the colors: must give one more breakpoint than
ncol
.
specifies a certain range values should be plotted for.
specifies the legend decimal places.
see argument d
in function persp
.
see argument r
in function persp
.
scales the outer ranges of x
and z
limits used for interpolation.
if x
is a formula
, a data.frame
or list
. By default the
variables are taken from environment(x)
: typically the environment from which
plot3d
is called. Note that data
may also be a character file path to the data.
the field separator character when x
or data
is a character, see function
read.table
.
numeric. Constant to be added to the smooth before plotting.
function to be applied to the smooth before plotting, e.g., to transform the plot to the response scale.
character. Which type of interpolation metjod should be used. The default is
type = "interp"
, see function interp
. The two other options are
type = "mba"
, which calls function mba.surf
of package MBA, or
type = "mgcv"
, which uses a spatial smoother withing package mgcv for interpolation.
The last option is definitely the slowest, since a full regression model needs to be estimated.
logical. Should linear interpolation be used withing function
interp
?
logical. Should interpolations be computed outside the observation area (i.e., extrapolated)?
integer. The number of basis functions to be used to compute the interpolated surface
when type = "mgcv"
.
parameters passed to colorlegend
if an image plot with legend is drawn,
also other graphical parameters, please see the details.
Nikolaus Umlauf, Thomas Kneib, Stefan Lang, Achim Zeileis.
For 3D plots the following graphical parameters may be specified additionally:
plot.bayesx
, bayesx
, read.bayesx.output
,
fitted.bayesx
, colorlegend
.