plot_gam_3d: Plot 2d smooths in 3d

Description Usage Arguments Details Value See Also Examples

View source: R/plot_gam_3d.R

Description

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

Usage

1
2
3
4
5
6
7
8
9
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

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

Value

A plotly surface object

See Also

Other model visualization: plot_coefficients.brmsfit(), plot_coefficients.lm(), plot_coefficients.merMod(), plot_coefficients(), plot_gam_2d(), plot_gam_check(), plot_gam()

Examples

1
2
3
4
5
6
7
library(mgcv); library(visibly)
set.seed(0)

d = gamSim(2, scale=.1)$data
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')

m-clark/visibly documentation built on Oct. 28, 2020, 5:33 p.m.