summary.rgam {relgam} | R Documentation |
rgam summary routine
Description
Makes a two-panel plot of the rgam object showing coefficient paths.
Usage
## S3 method for class 'rgam'
summary(object, label = FALSE, index = NULL,
which = NULL, ...)
Arguments
object |
Fitted |
label |
If |
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
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)
[Package relgam version 1.0 Index]