sliceplot {bamlss}  R Documentation 
This function plots slices from user defined values of bivariate surfaces.
sliceplot(x, y = NULL, z = NULL, view = 1, c.select = NULL, values = NULL, probs = c(0.1, 0.5, 0.9), grid = 100, legend = TRUE, pos = "topright", digits = 2, data = NULL, rawdata = FALSE, type = "mba", linear = FALSE, extrap = FALSE, k = 40, rug = TRUE, rug.col = NULL, jitter = TRUE, ...)
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. Another
possibility is to specify the plot via a 
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 
Integer, selects the column that is used in the resulting matrix to be
used as the 
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 method 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 

rug.col 
Specify the color of the rug representation. 
... 
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
can use 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
https://www.acm.org/publications/policies/softwarecopyrightnotice
Function sliceplot
prints a note referring to the ACM license. This note can be suppressed by
setting
options("use.akima" = TRUE)
plot2d
, plot3d
,
plotmap
, plotblock
.
## Generate some data. set.seed(111) n < 500 ## Regressors. d < data.frame(z = runif(n, 3, 3), w = runif(n, 0, 6)) ## Response. d$y < with(d, 1.5 + cos(z) * sin(w) + rnorm(n, sd = 0.6)) ## Not run: ## Estimate model. b < bamlss(y ~ te(z, w), data = d) summary(b) ## Plot estimated effect. plot(b, term = "te(z,w)", sliceplot = TRUE) plot(b, term = "te(z,w)", sliceplot = TRUE, view = 2) plot(b, term = "te(z,w)", sliceplot = TRUE, view = "w") plot(b, term = "te(z,w)", sliceplot = TRUE, probs = seq(0, 1, length = 10)) ## End(Not run) ## Variations. d$f1 < with(d, sin(z) * cos(w)) sliceplot(cbind(z = d$z, w = d$w, f1 = d$f1)) ## Same with formula. sliceplot(sin(z) * cos(w) ~ z + w, ylab = "f(z)", data = d) ## Compare with plot3d(). plot3d(sin(z) * 1.5 * w ~ z + w, zlab = "f(z,w)", data = d) sliceplot(sin(z) * 1.5 * w ~ z + w, ylab = "f(z)", data = d) sliceplot(sin(z) * 1.5 * w ~ z + w, view = 2, ylab = "f(z)", data = d)