glmgraph {glmgraph} | R Documentation |
Fit a generalized linear model at grids of tuning parameter via penalized maximum likelihood. The regularization path is computed for a combination of sparse and smooth penalty at two grids of values for the regularization parameter lambda1(Lasso or MCP penalty) and lambda2(Laplacian penalty). Fits linear, logistic regression models.
glmgraph(X, Y, L, family=c("gaussian","binomial"), penalty=c("MCP","lasso") , mcpapproach=c("mmcd", "adaptive", "original"),gamma=8, lambda1,nlambda1=100,lambda2=c(0, 0.01 * 2^(0:7)),eps=1e-3,max.iter=2000, dfmax=round(ncol(X)/2),penalty.factor=rep(1,ncol(X)),standardize=TRUE,warn=FALSE,...)
X |
Input matrix; each row is an observation vector. |
Y |
Response vector. Quantitative for |
family |
Either "gaussian", "binomial", depending on the response. |
L |
User-specified Laplacian matrix. |
penalty |
The sparse penalty to be applied to the model. Either "MCP" (the default), or "lasso". |
mcpapproach |
For |
gamma |
The tuning parameter of the MCP penalty.The default value is 8. |
nlambda1 |
The number of |
lambda1 |
A user-specified sequence of |
lambda2 |
A user-specified sequence of |
eps |
Convergence threshold for coordinate descent. Each inner
coordinate-descent loop continues until the relative change in the
objective function is less than |
max.iter |
Maximum number of passes over the data for all |
dfmax |
Limit the maximum number of variables in the
model. Useful for very large |
penalty.factor |
A multiplicative factor for the penalty applied
to each coefficient. If supplied, |
standardize |
Logical flag for x variable standardization, prior to
fitting the model sequence. The coefficients are always returned on
the original scale. Default is |
warn |
Return warning messages for failures to converge and model selection issues. Default is FALSE. |
... |
Other parameters to |
An object "glmgraph"
containing:
betas |
A list of fitted coefficients. The number of rows for each matrix is equal to the number of coefficients, and the number of columns is smaller or equal to |
lambda1s |
A list of vector. Each vector is a sequence of used |
lambda2 |
A sequence of |
loglik |
A list of log likelihood for each value of |
df |
A list of the number of nonzero values for each value of |
Li Chen <li.chen@emory.edu>, Jun Chen <chen.jun2@mayo.edu>
Li Chen. Han Liu. Hongzhe Li. Jun Chen. (2015) Graph-constrained Regularization for Sparse Generalized Linear Models.(Working paper)
plot.glmgraph
, cv.glmgraph
set.seed(1234) library(glmgraph) n <- 100 p1 <- 10 p2 <- 90 p <- p1+p2 X <- matrix(rnorm(n*p), n,p) magnitude <- 1 A <- matrix(rep(0,p*p),p,p) A[1:p1,1:p1] <- 1 A[(p1+1):p,(p1+1):p] <- 1 diag(A) <- 0 btrue <- c(rep(magnitude,p1),rep(0,p2)) intercept <- 0 eta <- intercept+X%*%btrue ### construct laplacian matrix from adjacency matrix diagL <- apply(A,1,sum) L <- -A diag(L) <- diagL ### gaussian Y <- eta+rnorm(n) obj <- glmgraph(X,Y,L,family="gaussian") plot(obj) ### binomial Y <- rbinom(n,1,prob=1/(1+exp(-eta))) obj <- glmgraph(X,Y,L,family="binomial") plot(obj)