coef.glinternet: Return main effect and interaction coefficients.

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

View source: R/coef.glinternet.r

Description

Returns the actual main effect and interaction coefficients that satisfy the sum constraints in a linear interaction model. See the paper below for details.

Usage

1
2
## S3 method for class 'glinternet'
coef(object, lambdaIndex = NULL, ...)

Arguments

object

Fitted "glinternet" model object.

lambdaIndex

Index of lambda value at which to extract coefficients. If NULL, return the coefficients for all values of lambda in the path.

...

Not used.

Details

Returns the actual main effect and interaction coefficients. These satisfy the sum constraints in the original linear interaction model.

Value

A list of length lambda if lambdaIndex is not provided. Otherwise, of length lambdaIndex. Each component (for each lambda) is itself a list, with components

mainEffects

A list with components cat and cont, each an index vector of the categorical and continuous (resp) main-effect variables. Just as in activeSet, the indexing is separate for each type of variable. See ?glinternet for details.

mainEffectsCoef

List of coefficients for the main effects in mainEffects, also with names cat and cont

interactions

List of interactions, with components contcont, catcont and catcat, each 2-column matrices of variable indices.

interactionsCoef

List of interaction coefficients for interactions, also with names contcont, catcont and catcat. For categorical-categorical interactions, each is provided as a L1 x L2 matrix.

Author(s)

Michael Lim and Trevor Hastie
Maintainer: Michael Lim michael626@gmail.com

References

"Learning interactions via hierarchical group-lasso regularization"

See Also

glinternet.cv, predict.glinternet, predict.glinternet.cv, plot.glinternet.cv, glinternet

Examples

1
2
3
4
5
Y = rnorm(100)
X = matrix(rnorm(100*10), nrow=100)
numLevels = rep(1, 10)
fit = glinternet(X, Y, numLevels)
coeffs = coef(fit)

Example output

Loaded glinternet 1.0.5

glinternet documentation built on Sept. 5, 2021, 5:28 p.m.