Learn R Programming

glinternet (version 1.0.12)

coef.glinternet: Return main effect and interaction coefficients.

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

# S3 method for 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.

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.

Details

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

References

"Learning interactions via hierarchical group-lasso regularization"

See Also

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

Examples

Run this code
# NOT RUN {
Y = rnorm(100)
X = matrix(rnorm(100*10), nrow=100)
numLevels = rep(1, 10)
fit = glinternet(X, Y, numLevels)
coeffs = coef(fit)
# }

Run the code above in your browser using DataLab