summary.rgam: rgam summary routine

Description Usage Arguments Details Examples

Description

Makes a two-panel plot of the rgam object showing coefficient paths.

Usage

1
2
3
## S3 method for class 'rgam'
summary(object, label = FALSE, index = NULL,
  which = NULL, ...)

Arguments

object

Fitted rgam object.

label

If TRUE, annotate the plot with variable labels. Default is FALSE.

index

The indices of the lambda hyperparameter which we want the plot for. The default is to plot for the entire lambda path.

which

Which values to plot. Default is all variables.

...

Additional arguments to summary.

Details

A two panel plot is produced, that summarizes the linear components and the nonlinear components, as a function of lambda. For the linear components, it is the coefficient for each variable. For the nonlinear components, it is the coefficient of the non-linear variable. Nothing is returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
set.seed(1)
n <- 100; p <- 20
x <- matrix(rnorm(n * p), n, p)
beta <- matrix(c(rep(2, 5), rep(0, 15)), ncol = 1)
y <- x %*% beta + rnorm(n)

fit <- rgam(x, y)
opar <- par(mfrow = c(1, 2))
summary(fit)
par(opar)

# with labels, just variables 1 to 5
opar <- par(mfrow = c(1, 2))
summary(fit, label = TRUE, which = 1:5)
par(opar)

# as above, but just the first 30 values of lambda
opar <- par(mfrow = c(1, 2))
summary(fit, label = TRUE, which = 1:5, index = 1:30)
par(opar)

relgam documentation built on Jan. 13, 2020, 5:06 p.m.