3d plot of 2d smooths for generalized additive models.

plot_gam_3d(
  model,
  main_var,
  second_var,
  conditional_data = NULL,
  n_plot = 100,
  dmb = FALSE,
  ...
)

Arguments

model

The mgcv gam model

main_var

The 'x' axis.

second_var

The 'y' axis'

conditional_data

Values for other covariates. Default is NULL see details.

n_plot

Points to plot. 100 (the default) works well. Embiggen at the cost of your own waiting time.

dmb

Whether to use plotly's display mode bar. Default is FALSE.

...

Arguments for scico

Value

A plotly surface object

Details

This works like plot_gam_2d, the only difference being that a 3d plot is generated instead. It uses scico for the palette. It is expected that the two input variables are continuous

See also

Examples

library(mgcv); library(visibly) set.seed(0) d = gamSim(2, scale=.1)$data
#> Bivariate smoothing example
mod <- gam(y ~ s(x, z), data = d) plot_gam_3d(mod, main_var = x, second_var = z) plot_gam_3d(mod, main_var = x, second_var = z, palette='tokyo')