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, logistic and Cox models.
SGL(data, index, type = "linear", maxit = 1000, thresh = 0.001,
min.frac = 0.1, nlam = 20, gamma = 0.8, standardize = TRUE,
verbose = FALSE, step = 1, reset = 10, alpha = 0.95, lambdas = NULL)
For type="linear"
should be a list with $x$ an input matrix of dimension n-obs by p-vars, and $y$ a length $n$ response vector. For type="logit"
should be a list with $x$, an input matrix, as before, and $y$ a length $n$ binary response vector. For type="cox"
should be a list with x as before, time
, an n-vector corresponding to failure/censor times, and status
, an n-vector indicating failure (1) or censoring (0).
A p-vector indicating group membership of each covariate
model type: one of ("linear","logit", "cox")
Maximum number of iterations to convergence
Convergence threshold for change in beta
The minimum value of the penalty parameter, as a fraction of the maximum value
Number of lambda to use in the regularization path
Fitting parameter used for tuning backtracking (between 0 and 1)
Logical flag for variable standardization prior to fitting the model.
Logical flag for whether or not step number will be output
Fitting parameter used for inital backtracking step size (between 0 and 1)
Fitting parameter used for taking advantage of local strong convexity in nesterov momentum (number of iterations before momentum term is reset)
The mixing parameter. alpha
= 1 is the lasso penalty. alpha
= 0 is the group lasso penalty.
A user specified sequence of lambda values for fitting. We recommend leaving this NULL and letting SGL self-select values
An object with S3 class "SGL"
A p by nlam
matrix, giving the penalized MLEs for the nlam different models, where the index corresponds to the penalty parameter lambda
The actual sequence of lambda
values used (penalty parameter)
Response type (linear/logic/cox)
For some model types, an intercept is fit
A list used in predict
which gives the empirical mean and variance of the x matrix used to build the model
A user specified sequence of lambda values for fitting. We recommend leaving this NULL and letting SGL self-select values
The sequence of models along the regularization path is fit by accelerated generalized gradient descent.
Simon, N., Friedman, J., Hastie, T., and Tibshirani, R. (2011) A Sparse-Group Lasso, http://faculty.washington.edu/nrsimon/SGLpaper.pdf
cv.SGL
# NOT RUN {
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)
data = list(x = X, y = y)
fit = SGL(data, index, type = "linear")
# }
Run the code above in your browser using DataLab