summary.gamlasso: Summary for a gamlasso fit

Description Usage Arguments Details See Also Examples

View source: R/output.R

Description

Default sumary method for a gamlasso object

Usage

1
2
## S3 method for class 'gamlasso'
summary(object, s = "lambda.min", ...)

Arguments

object

fitted model object of the class gamlasso as produced by gamlasso

s

Value of the lasso penalty parameter lambda at which predictions are required. Default is "lambda.min" but alternatively "lambda.1se" can be used.

...

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 λ 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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

plsmselect documentation built on Dec. 1, 2019, 1:11 a.m.