Retrieve coefficients from a fitted "glmgraph" object.

Share:

Description

Retrieve coefficients from a fitted "glmgraph" object, depending on the user-specified regularization parameters.

Usage

1
2
## S3 method for class 'glmgraph'
coef(object,lambda1,lambda2,...)

Arguments

object

Fitted "glmgraph" model object.

lambda1

Values of the regularization parameter lambda1 at which retrieval of coefficients are requested. For values of lambda1 not in the sequence of fitted models, linear interpolation is used. However, lambda1 should be within the range of lambda1 used to fit glmgraph object.

lambda2

The user-specified regularization lambda2 should be exactly subset of the lambda2 used to fit glmgraph object. Linear interpolation is not used.

...

Other parameters to coef

Details

If lambda1 and lambda2 are missing, all coefficients of fitted glmgraph object will be returned. If only lambda1 is missing, then coefficients of specified lambda2 will be returned.

Value

The object returned depends on type.

Author(s)

Li Chen <li.chen@emory.edu>, Jun Chen <chen.jun2@mayo.edu>

References

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

See Also

predict.glmgraph,glmgraph

Examples

 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
 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)
 obj <- glmgraph(X,Y,L)
 coefs <- coef(obj)
 coefs <- coef(obj,lambda2=0.01)
 coefs <- coef(obj,lambda1=c(0.11,0.12))
 coefs <- coef(obj,lambda1=c(0.11,0.12),lambda2=0.01)