plot_basis_splines_1d: Plot basis splines of a smooth parameter estimated from...

Description Usage Arguments Value Author(s)

View source: R/plot_basis_splines_1d.R

Description

From a one dimensional GAM model produced by mgcv::gam(), display a ggplot2 based plot of all the basis spline components that add up to a single smooth parameter.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
plot_basis_splines_1d(
  gam_model = NULL,
  data_var = NULL,
  show_points = FALSE,
  title = NULL,
  subtitle = NULL,
  center_titles = FALSE,
  x_limits = NULL,
  x_major_breaks = waiver(),
  y_limits = NULL,
  y_major_breaks = waiver(),
  line_type = "dashed",
  line_color = "black",
  line_width = 1
)

Arguments

gam_model

A gam one dimensional model produced after fitting data from the mgcv::gam() function.

data_var

A string that is the name of one of the data variables in the GAM model.

show_points

A logical which if TRUE will plot the observed points.

title

A string that sets the plot title.

subtitle

A string that sets the plot subtitle.

center_titles

A logical which if TRUE centers both the title and subtitle.

x_limits

Depending on the class of aes_x, a numeric/Date/POSIXct 2 element vector that sets the minimum and maximum for the x axis.

x_major_breaks

A numeric vector that defines the exact major tic locations along the x axis for all smooth parameters. If not set then the smooth parameter has x axis scaling using ggplot2 defaults.

y_limits

A numeric 2 element vector that sets the minimum and maximum for the y axis for the smooth parameter.

y_major_breaks

A numeric vector that defines the exact major tic locations along the y axis for the smooth parameter. If not set then the smooth parameter has y axis scaling using ggplot2 defaults.

line_type

A string that sets the line type for the basis splines. Typical values are twodash, solid, longdash, dotted, dotdash, dashed, blank

line_color

A string that sets the color of the lines.

line_width

A numeric value that sets the width of lines.

Value

A ggplot2 plot object

Author(s)

Rick Dean


deandevl/RgamPkg documentation built on Sept. 17, 2021, 2:02 p.m.