Description Usage Arguments Value Author(s) References See Also Examples
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.
1 2 3 4 |
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)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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)
|
Loading required package: Rcpp
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.