Model Matrix for Lasso

Share:

Description

Generates the model matrix and adds information about variables to be penalized or non-penalized by the L1 term in the lasso fitting. The user will rarely call this function.

Usage

1
2

Arguments

m

call to the lasso function

formula

model formula

nonpen

formula defining the non-penalized variables

data

data.frame in which the variables are found

weights

as in lm

subset

as in lm

na.action

as in lm

contrasts

as in lm

env

environment in which the formula is evaluated

Details

This function generates the model.matrix and the 'index' vector which stores the information about penalization

Value

x

model.matrix

y

response

w

weights

off

offset

mf

model.frame

index

vector of length ncol(x) determining groups for penalization. Negative values correspond to non-penalized variables.

Author(s)

Lukas Meier, modified by Werner Stahelstahel@stat.math.ethz.ch

Examples

1
## not to be called by the user. Is called from function lasso.