This function plots slices from user defined values of bivariate surfaces.
1 2 3 4 5 6 
x 
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 
y 
if 
z 
if 
view 
which variable should be used for the xaxis of the plot, the other variable will be
used to compute the slices. May also be a 
c.select 

values 
the values of the 
probs 
numeric vector of probabilities with values in [0,1] to be used within function

grid 
the grid size of the surface where the slices are generated from. 
legend 
if set to 
pos 
the position of the legend, see also function 
digits 
the decimal place the legend values should be rounded. 
data 
if 
rawdata 
if set to 
type 
character. Which type of interpolation metjod should be used. The default is

linear 
logical. Should linear interpolation be used withing function

extrap 
logical. Should interpolations be computed outside the observation area (i.e., extrapolated)? 
k 
integer. The number of basis functions to be used to compute the interpolated surface
when 
rug 
add a 
jitter 
if set to 
rug.col 
specify the color of the rug representation. 
... 
parameters passed to 
Similar to function plot3d
, this function first applies bivariate interpolation
on a regular grid
, afterwards the slices are computed from the resulting surface.
Function sliceplot
uses per default the akima package to construct smooth interpolated
surfaces, therefore, package akima needs to be installed. The akima package has an ACM
license that restricts applications to noncommercial usage, see
http://www.acm.org/publications/policies/softwarecrnotice
Function sliceplot
prints a note refering to the ACM licence. This note can be supressed by
setting
options("use.akima" = TRUE)
Nikolaus Umlauf, Thomas Kneib, Stefan Lang, Achim Zeileis.
plot.bayesx
, bayesx
, read.bayesx.output
,
fitted.bayesx
, plot3d
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36  ## generate some data
set.seed(111)
n < 500
## regressors
dat < data.frame(z = runif(n, 3, 3), w = runif(n, 0, 6))
## response
dat$y < with(dat, 1.5 + cos(z) * sin(w) + rnorm(n, sd = 0.6))
## Not run:
## estimate model
b < bayesx(y ~ sx(z, w, bs = "te", knots = 5), data = dat, method = "REML")
summary(b)
## plot estimated effect
plot(b, term = "sx(z,w)", sliceplot = TRUE)
plot(b, term = "sx(z,w)", sliceplot = TRUE, view = 2)
plot(b, term = "sx(z,w)", sliceplot = TRUE, view = "w")
plot(b, term = "sx(z,w)", sliceplot = TRUE, c.select = 4)
plot(b, term = "sx(z,w)", sliceplot = TRUE, c.select = 6)
plot(b, term = "sx(z,w)", sliceplot = TRUE, probs = seq(0, 1, length = 10))
## End(Not run)
## another variation
dat$f1 < with(dat, sin(z) * cos(w))
sliceplot(cbind(z = dat$z, w = dat$w, f1 = dat$f1))
## same with formula
sliceplot(sin(z) * cos(w) ~ z + w, ylab = "f(z)", data = dat)
## compare with plot3d()
plot3d(sin(z) * 1.5 * w ~ z + w, zlab = "f(z,w)", data = dat)
sliceplot(sin(z) * 1.5 * w ~ z + w, ylab = "f(z)", data = dat)
sliceplot(sin(z) * 1.5 * w ~ z + w, view = 2, ylab = "f(z)", data = dat)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.