plot.gamsel: Plotting Routine 'gamsel' Object

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/plot.gamsel.R

Description

Produces plots of the estimated functions for specified variables at a given value of lambda.

Usage

1
2
## S3 method for class 'gamsel'
plot(x, newx, index, which = 1:p, rugplot = TRUE, ylims, ...)

Arguments

x

Fitted gamsel object.

newx

nobs_new x p matrix giving values of each predictor at which to plot.

index

Index of lambda value (i.e., model) for which plotting is desired.

which

Which values to plot. Default is all variables, i.e. {1,2,...,nvars}. Besides indices, which can take two special values: "nonzero" will plot only the nonzero functions, and "nonlinear" only the nonlinear functions.

rugplot

If TRUE, a rugplot showing values of x is shown at the bottom of each fitted function plot.

ylims

ylim argument for plotting each curve, which overides the default which is the range of all the functions.

...

Optional graphical parameters to plot.

Details

A plot of the specified fitted functions is produced. Nothing is returned.

Author(s)

Alexandra Chouldechova and Trevor Hastie
Maintainer: Trevor Hastie hastie@stanford.edu

References

Chouldechova, A. and Hastie, T. (2015) Generalized Additive Model Selection

See Also

gamsel, and print.gamsel, summary.gamsel

Examples

1
2
3
4
5
6
7
8
9
##set.seed(1211)
##data=gamsel:::gendata(n=500,p=12,k.lin=3,k.nonlin=3,deg=8,sigma=0.5)
data = readRDS(system.file("extdata/gamsel_example.RDS", package = "gamsel"))
attach(data)
bases=pseudo.bases(X,degree=10,df=6)
# Gaussian gam
gamsel.out=gamsel(X,y,bases=bases)
par(mfrow=c(3,4))
plot(gamsel.out,newx=X,index=20)

gamsel documentation built on Feb. 4, 2022, 5:09 p.m.