Learn R Programming

glmgraph (version 1.0.3)

plot.cv.glmgraph: Plot the cross-validation curve produced by cv.glmgraph

Description

Plots the cross-validation curve for the "cv.glmgraph" object, along with standard error bars.

Usage

"plot"(x,...)

Arguments

x
A "cv.glmgraph" object.
...
Other graphical parameters to plot

References

Li Chen. Han Liu. Hongzhe Li. Jun Chen. (2015) glmgraph: Graph-constrained Regularization for Sparse Generalized Linear Models.(Working paper)

See Also

glmgraph, cv.glmgraph

Examples

Run this code
 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)
 cv.obj <- cv.glmgraph(X,Y,L)
 plot(cv.obj)

Run the code above in your browser using DataLab