ggDiagnose.Gam: Diagnostic plot for 'Gam' object ('ggplot2' based)

Description Usage Arguments Details Value Examples

View source: R/Gam.R

Description

this function mimics the plot.Gam function from the gam package, not the plot.gam from the mgcv package.

Usage

1
2
3
4
ggDiagnose.Gam(x, residuals = NULL, rugplot = TRUE, se = TRUE,
  terms = labels.Gam(x), ..., jitter = TRUE, point.shape = 1,
  color = "black", se.color = "black", se.alpha = 0.2,
  se.linetype = 2, show.plot = TRUE, return = FALSE, nrow = "sqrt")

Arguments

x

Gam object from gam library

residuals

if TRUE, partial deviance residuals are plotted along with the fitted terms<e2><80><94>default is FALSE. If residuals is a vector with the same length as each fitted term in x, then these are taken to be the overall residuals to be used for constructing the partial residuals.

rugplot

if TRUE (the default), a univariate histogram or rugplot is displayed along the base of each plot, showing the occurrence of each <e2><80><98>x<e2><80><99>; ties are broken by jittering (see parameter option below.

se

if TRUE (the default), upper and lower pointwise twice-standard-error curves are included for each plot.

terms

subsets of the terms can be selected.

...

(extra parameters, passed to dfCompile.Gam).

jitter

if TRUE (the default), rug points and plotted residual points are jittered. (Note ggplot2's jitter is different than base plot.)

point.shape

shape of points (the default is 1, an open circle).

color

color for curves (or points if variable is discrete).

se.color

color of se band.

se.alpha

opacity of ribbon of se band if variable is continuous.

se.linetype

linetype of se band if variable is discrete.

show.plot

if TRUE, a display the graphics (group of graphics in this case) is returned.

return

if TRUE, a list of graphics and the data frame to make the majority of graphics is returned.

nrow

integer number of rows in the displayed graphic. (Default is "sqrt", which makes the show.plot output on a square grid)

Details

(however thought to make 2 types of gams is annoying.) remove when have both.

Value

depending on show.plot and return it will return the visualization of the graphics and/or a list of both the data frame used the make the majority of the graphic and a list of each individual graphic.

Examples

1
2
3
4
5
6
7
8
library(gam)
gam.object <- gam::gam(Sepal.Length ~ gam::s(Sepal.Width) + Species,
                       data = iris)

par(mfrow = c(1,2))
plot(gam.object, se = TRUE, residuals = TRUE)

ggDiagnose(gam.object, residuals = TRUE) # se = TRUE by default

benjaminleroy/ggDiagnose documentation built on May 4, 2019, 3:07 a.m.