summary.gamlasso {plsmselect} | R Documentation |
Summary for a gamlasso fit
Description
Default sumary method for a gamlasso
object
Usage
## S3 method for class 'gamlasso'
summary(object, s = "lambda.min", ...)
Arguments
object |
fitted model object of the class |
s |
Value of the lasso penalty parameter |
... |
Other arguments |
Details
Outputs a list of two. gam
prints a summary of the
gam model (the same output as summary(object$gam)
) if it
is non-null. Objects of the class cv.glmnet
do not have a
default summary method, so the list item lasso
produces the
coefficients of the cross-vaidated lasso fit corresponding to the
lowest value of the \lambda
used ( the same output as
coef(object$cv.glmnet, s = "lambda.min")
if it is non-null).
See Also
gamlasso
, summary.gam
,
coef.cv.glmnet
.
Examples
library(plsmselect)
data(simData)
## Fit binomial gamlasso model using the term specification
## approach with binomial counts response
## (L2-penalty on linear terms & L1-penalty on smooth terms)
bfit = gamlasso(c("success","failure"),
linear.terms=paste0("x",1:10),
smooth.terms=paste0("z",1:4),
data=simData,
family = "binomial",
linear.penalty = "l2",
smooth.penalty = "l1",
num.knots = 5,
seed=1)
## Since the above model has linear.penalty = "l2" it is
## a pure GAM model (i.e. no LASSO component):
bfit$cv.glmnet
## Summary of model (here essentially the same as summary(bfit$gam)
## because there is no LASSO component, i.e. linear.penalty="l2")
summary(bfit)
## We could use the formula approach below to fit the same model as above:
simData$X = model.matrix(~x1+x2+x3+x4+x5+x6+x7+x8+x9+x10, data=simData)[,-1]
bfit = gamlasso(cbind(success,failure) ~ X + s(z1, bs="ts") +
s(z2, bs="ts") + s(z3, bs="ts") + s(z4, bs="ts"),
data = simData,
family = "binomial",
linear.penalty = "l2",
smooth.penalty = "l1",
seed=1)
## For a binary responses we only need one response variable in the formula
bfit2 = gamlasso(Yb ~ X + s(z1, bs="ts") + s(z2, bs="ts") + s(z3, bs="ts") + s(z4, bs="ts"),
data = simData,
family = "binomial",
seed=1)
# See ?gamlasso for an example fitting a gaussian response model
# See ?predict.gamlasso for an example fitting a poisson response model
# See ?cumbasehaz for an example fitting a survival response model
[Package plsmselect version 0.2.0 Index]