plot_gam_check: The visualization part of gam.check

Description Usage Arguments Details Value See Also Examples

View source: R/plot_gam_check.R

Description

Residual plots etc.

Usage

1
2
3
4
5
6
7
plot_gam_check(
  model,
  single_page = TRUE,
  type = "deviance",
  scatter = FALSE,
  kcheck = FALSE
)

Arguments

model

The mgcv gam model

single_page

Plot all on a single page. Requires grid.arrange

type

The type of residuals wanted. Usually one of "deviance", "pearson","scaled.pearson", "working", or "response"., See residuals.gam.

scatter

Whether to plot fitted vs. observed target variable as scatter plot or density. Default is FALSE (density).

kcheck

If you want the slightly less verbose basis dimension (k) checking results. Default is FALSE. When true, only uses the defaults of gam.check. If you need to do more, use mgcv.

Details

Just a single page version of gam.check.

Value

A ggplot that provides visual inspection of residuals and more.

See Also

gam.check

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

Examples

1
2
3
4
5
6
7
8
library(mgcv); library(visibly)

d <- gamSim(1, n = 400)

g_fit <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = d)

plot_gam_check(g_fit)
plot_gam_check(g_fit, scatter=TRUE)

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