Description Usage Arguments Details Value Author(s) References See Also Examples
Performs kfold cross validation for glmgraph
1  cv.glmgraph(X,Y,L,...,type.measure=c("mse","mae","deviance","auc"),nfolds=5,trace=TRUE)

X 

Y 
Response 
L 
Userspecified Laplacian matrix 
... 
Additional arguments as in 
type.measure 
if 
nfolds 
The number of crossvalidation folds. Default is 5. 
trace 
Print out the cross validation steps if 
The function runs glmgraph
nfolds
+1 times; the
first to get the lambda1
and lambda2
sequence, and then the remainder to
compute the fit with each of the folds omitted. The error is
accumulated, and the average error and standard deviation over the
folds is computed.
Note also that the results of cv.glmgraph
are
random, since the folds are selected at random. Users can reduce this
randomness by running cv.glmgraph
many times, and averaging the
error curves.
An object "cv.glmgraph"
containing:
obj 
The fitted 
cvmat 
A data frame summarized cross validation results, which could be obtained by 
cvm 
The mean crossvalidated 
cvsd 
The estimate of standard error of 
cvmin 
Best crossvalidation 
cv.1se 
Simliar to 
lambda1.min 
Coupled with 
lambda2.min 
Coupled with 
lambda1.1se 
Coupled with 
lambda2.1se 
Coupled with 
beta.min 
Estimated beta with best 
beta.1se 
Estimated beta with best 
Li Chen <li.chen@emory.edu> , Jun Chen <chen.jun2@mayo.edu>
Li Chen. Han Liu. Hongzhe Li. Jun Chen(2015) glmgraph: Graphconstrained Regularization for Sparse Generalized Linear Models.(Working paper)
glmgraph
,coef.cv.glmgraph
,predict.cv.glmgraph
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
## construct laplacian matrix from adjacency matrix
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
diagL < apply(A,1,sum)
L < A
diag(L) < diagL
btrue < c(rep(magnitude,p1),rep(0,p2))
intercept < 0
eta < intercept+X%*%btrue
### gaussian
Y < eta+rnorm(n)
cv.obj < cv.glmgraph(X,Y,L,penalty="lasso",lambda2=c(0,1.28))
beta.min < coef(cv.obj)
print(cv.obj)
### binomial
Y < rbinom(n,1,prob=1/(1+exp(eta)))
cv.obj < cv.glmgraph(X,Y,L,family="binomial",lambda2=c(0,1.28),penalty="lasso",type.measure="auc")
beta.min < coef(cv.obj)
print(cv.obj)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.