Description Usage Arguments Author(s) References See Also Examples

View source: R/predict.cv.glmgraph.R

This function makes predictions from a cross-validated glmgraph model,
using the stored `"cv.glmgraph"`

object, and the optimal value
chosen for `lambda1`

and `lambda2`

.

1 2 3 |

`object` |
Fitted |

`X` |
Matrix at which predictions are to be made. |

`s` |
Either |

`type` |
Type of prediction: |

`...` |
Other parameters to |

Li Chen <li.chen@emory.edu> , Jun Chen <chen.jun2@emory.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 | ```
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
btrue <- c(rep(magnitude,p1),rep(0,p2))
intercept <- 0
eta <- intercept+X%*%btrue
diagL <- apply(A,1,sum)
L <- -A
diag(L) <- diagL
### gaussian
Y <- eta+rnorm(n)
cv.obj <- cv.glmgraph(X,Y,L)
beta.min <- predict(cv.obj,X,type="coefficients")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.