SGL: Fit a GLM with a combination of lasso and group lasso with...

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

View source: R/SGLmain.R

Description

Fit a regularized generalized linear model via penalized maximum likelihood. The model is fit for a path of values of the penalty parameter. Fits linear and logistic models.

Usage

1
2
3
SGL(data, index=NULL, weights=NULL, type = c("linear","logit"), alphas = 0.95, nlam = 20,
	standardize = TRUE, maxit = 1000, thresh = 0.001, min.frac = 0.1, gamma = 0.8, step = 1, reset = 10,
	ncores = 1, lambdas = NULL)

Arguments

data

A list with components $x$, an input matrix of dimension $(n,p)$, and $y$, a response vector of length $n$. For type="logit" $y$ should be binary.

index

A $p$-vector indicating group membership of each covariate

weights

Optional vector of weights for the group penalties

type

Model type: "linear" or "logit"

alphas

Vector of mixing parameters. The value 1 yields the lasso penalty. The value 0 yields the group lasso penalty.

nlam

Number of lambda values to use in the regularization path

standardize

Logical flag for variable standardization prior to fitting the model.

maxit

Maximum number of iterations to convergence

thresh

Convergence threshold for change in beta

min.frac

Minimum value of the penalty parameter, as a fraction of the maximum value

gamma

Fitting parameter used for tuning backtracking (between 0 and 1)

step

Fitting parameter used for initial backtracking step size (between 0 and 1)

reset

Fitting parameter used for taking advantage of local strong convexity in Nesterov momentum (number of iterations before momentum term is reset)

lambdas

Optional sequence of lambda values for fitting. We recommend leaving this NULL and letting SGL self-select values

Details

The sequence of models along the regularization path is fit by accelerated generalized gradient descent. If specified, argument weights should be a vector whose length is the number of groups. By default, weights is set to the square root of group sizes.

Value

A single object of class "creNet" or a list of such objects if alphas has length >1. For each value in alphas, the result has components:

beta

A p by nlam matrix, giving the penalized MLEs for the nlam different models, where the index corresponds to the penalty parameter lambda

lambdas

The actual sequence of lambda values used (penalty parameter)

type

Response type (logistic/linear)

intercept

For some model types, an intercept is fit

X.transform

A list used in predict which gives the empirical mean and variance of the x matrix used to build the model

lambdas

The sequence of lambda values used for fitting

Author(s)

Kourosh Zarringhalam and David Degras

Modified from SGL package: Noah Simon, Jerome Friedman, Trevor Hastie, and Rob Tibshirani

Maintainer: Kourosh Zarringhalam <[email protected]>

References

Simon, N., Friedman, J., Hastie, T., and Tibshirani, R. (2011) A Sparse-Group Lasso,
http://web.stanford.edu/~hastie/Papers/SGLpaper.pdf

See Also

cvSGL, predict.SGL

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
n = 50; p = 100; size.groups = 10
index <- ceiling(1:p / size.groups)
X = matrix(rnorm(n * p), ncol = p, nrow = n)
beta = (-2:2)
y = X[,1:5] %*% beta + 0.1*rnorm(n)
y = ifelse((exp(y) / (1 + exp(y))) > 0.5, 1, 0)
data = list(x = X, y = y)
weights = rep(1, size.groups)
fit = creSGL(data, index, weights, type = "linear", maxit = 1000, thresh = 0.001, 
	min.frac = 0.05, nlam = 100, gamma = 0.8, standardize = TRUE, verbose = FALSE, 
	step = 1, reset = 10, alphas = 0.05, lambdas = NULL)

kouroshz/creNet documentation built on Feb. 25, 2018, 12:41 p.m.