Description Usage Arguments Details Value Author(s) References See Also Examples
Using overlap grouped lasso penalties, gamsel selects whether a term in a gam is nonzero, linear, or a non-linear spline (up to a specified max df per variable). It fits the entire regularization path on a grid of values for the overall penalty lambda, both for gaussian and binomial families.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
x |
Input (predictor) matrix of dimension |
y |
Response variable. Quantitative for |
num_lambda |
Number of |
lambda |
User-supplied |
family |
Response type. |
degrees |
An integer vector of length |
gamma |
Penalty mixing parameter 0 ≤γ≤ 1. Values γ < 0.5 penalize linear fit less than non-linear fit. The default is γ = 0.4, which encourages a linear term over a nonlinear term. |
dfs |
Numeric vector of length |
bases |
A list of orthonormal bases for the non-linear terms for each
variable. The function |
tol |
Convergence threshold for coordinate descent. The coordinate
descent loop continues until the total change in objective after a pass over
all variables is less than |
max_iter |
Maximum number of coordinate descent iterations over all the
variables for each |
traceit |
If |
parallel |
passed on to the |
... |
additional arguments passed on to |
The sequence of models along the lambda
path is fit by (block)
cordinate descent. In the case of logistic regression the fitting routine
may terminate before all num_lambda
values of lambda
have been
used. This occurs when the fraction of null deviance explained by the model
gets too close to 1, at which point the fit becomes numerically unstable.
Each of the smooth terms is computed using an approximation to the
Demmler-Reinsch smoothing spline basis for that variable, and the
accompanying diagonal pernalty matrix.
An object with S3 class gamsel
. %% If it is a LIST, use
intercept |
Intercept sequence of length |
alphas |
|
betas |
|
lambdas |
The sequence of lambda values used |
degrees |
Number of basis functions used for each variable |
parms |
A set of parameters that capture the bases used. This
allows for efficient generation of the bases elements for
|
, the predict
method for this class.
family |
|
nulldev |
Null deviance (deviance of the intercept model) |
dev.ratio |
Vector of
length |
call |
The call that produced this object |
%% ...
Alexandra Chouldechova and Trevor Hastie
Maintainer: Trevor
Hastie hastie@stanford.edu
Chouldechova, A. and Hastie, T. (2015) Generalized Additive Model Selection, https://arxiv.org/abs/1506.03850
predict.gamsel
, cv.gamsel
,
plot.gamsel
, summary.gamsel
,
basis.gen
,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ##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(1,2),mar=c(5,4,3,1))
summary(gamsel.out)
gamsel.cv=cv.gamsel(X,y,bases=bases)
par(mfrow=c(1,1))
plot(gamsel.cv)
par(mfrow=c(3,4))
plot(gamsel.out,newx=X,index=20)
# Binomial model
gamsel.out=gamsel(X,yb,family="binomial")
par(mfrow=c(1,2),mar=c(5,4,3,1))
summary(gamsel.out)
par(mfrow=c(3,4))
plot(gamsel.out,newx=X,index=30)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.