glinternet(X, Y, numLevels, lambda = NULL, nLambda = 50, lambdaMinRatio = 0.01,
screenLimit = NULL, numToFind = NULL, family = c("gaussian","binomial"),
tol = 1e-05, maxIter=5000, verbose=FALSE, numCores = 1)
lambda
sequence. Typical usage
is to have the program compute its own lambda
sequence based on
nLambda
and lambdaMinRatio
. Supplying a value of
lambda
overrides tlambda
values. Default is 50.lambda
, as a fraction of
lambdaMax
, the (data derived) entry value (i.e. the smallest
value for which all coefficients are zero). The default is 0.01
.screenLimit
x nvars by only considering
interactions with the best screenLimit
candidate main effects
at each point along the regularizationumToFind
interaction
pairs are found. Default is null - fit all values of lambda
.glinternet
with the componentsnLambda
. If numToFind
is specified, the program is
likely to stop before all nLambda
models have been fit.lambda
sequence used.nLambda
) of the variables found. Internally, the
categorical and continuous variables are separated into two groups,
and each has their own indexing system (1-based). For example, the
categorical-continuous interaction c(i, j)
refers to the
interaction between the i
-th categorical variable with the
j
-th continuous variable.lambda
) of coefficients for the variables in
activeSet
. The first component is the intercept. Subsequent entries correspond to the variables in activeSet. For example, if the first variable in activeSet is a 3-level categorical variable, then components 2-4 of betahat are the coefficients for this variable.lambda
is fit by FISTA (fast
iterative soft thresholding) with adaptive step size and adaptive
momentum restart. The continuous features are standardized to have
unit norm and mean zero before computing the lambda
sequence
and fitting. The returned coefficients are unstandardized. Categorical
variables are not standardized.glinternet.cv
, predict.glinternet
,
predict.glinternet.cv
, plot.glinternet.cv
, coef.glinternet
# gaussian response, continuous features
Y = rnorm(100)
X = matrix(rnorm(100*10), nrow=100)
numLevels = rep(1, 10)
fit = glinternet(X, Y, numLevels)
#binary response, continuous features
Y = rbinom(100, 1, 0.5)
fit = glinternet(X, Y, numLevels, family="binomial")
#binary response, categorical variables
X = matrix(sample(0:2, 100*10, replace=TRUE), nrow=100)
numLevels = rep(3, 10)
fit = glinternet(X, Y, numLevels, family="binomial")
Run the code above in your browser using DataLab