summary.flam: Summarizes a Call to 'flam'

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

View source: R/flam_fcns.R

Description

This function summarizes a call to flam, as well as the sparsity pattern of the resulting feature estimates for a single or all fits.

Usage

1
2
3
4
## S3 method for class 'flam'
summary(object, index = NULL, ...)
## S3 method for class 'flamSparsity'
plot(x, ...)

Arguments

object

an object of class "flam".

index

the index for the fit of interest to be summarized. Note that index of i corresponds to the model with tuning parameters object$all.alpha[i] and object$all.lambda[i]. If index is not specified, information summarizing all fits is given.

x

an object of class 'flamSparsity', which is silently returned by summary.flam.

...

additional arguments to be passed. These are ignored in this function.

Value

If index is not specified, summary.flam silently returns the sparsity matrix and tuning parameters in an object of class 'flamSparsity'. This is used when plot(summary(object)) is called.

Author(s)

Ashley Petersen

References

Petersen, A., Witten, D., and Simon, N. (2014). Fused Lasso Additive Model. arXiv preprint arXiv:1409.5391.

See Also

flam

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#See ?'flam-package' for a full example of how to use this package

#generate data
set.seed(1)
data <- sim.data(n = 50, scenario = 1, zerof = 10, noise = 1)
#fit model for a range of tuning parameters
flam.out <- flam(x = data$x, y = data$y, alpha.seq = c(0.8, 0.9, 1))

#summarize all of the fits (in particular, the percent sparsity achieved)
#note: percent sparsity is the percentage of features estimated to have 
#no relationship with outcome
summary(flam.out)
#the percent sparsity over the range of tuning parameters can also 
#be displayed in a plot
plot(summary(flam.out))

#we can also summarize the fit with a specific index, e.g. 25
#that is, lambda and alpha of
flam.out$all.lambda[25]; flam.out$all.alpha[25]
summary(flam.out, index = 25)

flam documentation built on May 2, 2019, 8:27 a.m.