Last data update: 2014.03.03
R: Linearized Bregman solver for composite conditionally...
Linearized Bregman solver for composite conditionally likelihood of Gaussian Graphical
model with lasso penalty.
Description
Solver for the entire solution path of coefficients.
Usage
ggm(X, kappa, alpha, S = NA, c = 2, tlist, nt = 100, trate = 100,
print = FALSE)
Arguments
X
An n-by-p matrix of variables.
kappa
The damping factor of the Linearized Bregman Algorithm that is
defined in the reference paper. See details.
alpha
Parameter in Linearized Bregman algorithm which controls the
step-length of the discretized solver for the Bregman Inverse Scale Space.
See details.
S
The covariance matrix can be provided directly if data matrix X is missing.
c
Normalized step-length. If alpha is missing, alpha is automatically generated by
alpha=c*n/(kappa*||X^T*X||_2)
. Default is 2. It should be in (0,4).
If beyond this range the path may be oscillated at large t values.
tlist
Parameters t along the path.
nt
Number of t. Used only if tlist is missing. Default is 100.
trate
tmax/tmin. Used only if tlist is missing. Default is 100.
print
If TRUE, the percentage of finished computation is printed.
Details
The data matrix X is assumed to follow the Gaussian Graohical model which is described as following:
X sim N(μ, Θ^{-1})
where Θ is sparse p-by-p symmetric matrix. Then conditional on x_{-j}
x_j sim N(μ_j - ∑_{k\neq j}Θ_{jk}/Θ_{jj}(x_k-μ_k),1/Θ_{jj})
then the composite conditional likelihood is like this:
- ∑_{j} condloglik(X_j | X_{-j})
or in detail:
∑_{j} Θ_{j}^TSΘ_{j}/2Θ_{jj} - ln(Θ_{jj})/2
where S is covariance matrix of data. It is easy to prove that this loss function
is convex.
Value
A "ggm" class object is returned. The list contains the call,
the path, value for alpha, kappa, t.
Author(s)
Jiechao Xiong
Examples
library(MASS)
p = 20
Omega = diag(1,p,p)
Omega[0:(p-2)*(p+1)+2] = 1/3
Omega[1:(p-1)*(p+1)] = 1/3
S = solve(Omega)
X = mvrnorm(n=500,rep(0,p),S)
obj = ggm(X,10,trate=10)
obj$path[,,50]
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Libra)
Loading required package: nnls
Loaded Libra 1.5
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Libra/ggm.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ggm
> ### Title: Linearized Bregman solver for composite conditionally likelihood
> ### of Gaussian Graphical model with lasso penalty.
> ### Aliases: ggm
> ### Keywords: regression
>
> ### ** Examples
>
>
> library(MASS)
> p = 20
> Omega = diag(1,p,p)
> Omega[0:(p-2)*(p+1)+2] = 1/3
> Omega[1:(p-1)*(p+1)] = 1/3
> S = solve(Omega)
> X = mvrnorm(n=500,rep(0,p),S)
> obj = ggm(X,10,trate=10)
> obj$path[,,50]
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 0.8787928 0.2867970 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[2,] 0.2867970 1.0081985 0.2916727 0.0000000 0.0000000 0.0000000 0.0000000
[3,] 0.0000000 0.2916727 0.8522804 0.3063618 0.0000000 0.0000000 0.0000000
[4,] 0.0000000 0.0000000 0.3063618 0.9833125 0.2729527 0.0000000 0.0000000
[5,] 0.0000000 0.0000000 0.0000000 0.2729527 0.9622921 0.3345270 0.0000000
[6,] 0.0000000 0.0000000 0.0000000 0.0000000 0.3345270 0.9156846 0.3427449
[7,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.3427449 1.1674301
[8,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.2742644
[9,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[10,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[11,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[12,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[13,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[14,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[15,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[16,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[17,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[18,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[19,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[20,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[,8] [,9] [,10] [,11] [,12] [,13] [,14]
[1,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[2,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[3,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[4,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[5,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[6,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[7,] 0.2742644 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[8,] 0.7179820 0.3746382 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[9,] 0.3746382 1.3711739 0.3697684 0.0000000 0.0000000 0.0000000 0.0000000
[10,] 0.0000000 0.3697684 1.0339980 0.2967111 0.0000000 0.0000000 0.0000000
[11,] 0.0000000 0.0000000 0.2967111 0.8648693 0.3288431 0.0000000 0.0000000
[12,] 0.0000000 0.0000000 0.0000000 0.3288431 1.0017539 0.3490455 0.0000000
[13,] 0.0000000 0.0000000 0.0000000 0.0000000 0.3490455 1.2859651 0.3560441
[14,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.3560441 0.8665785
[15,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.2978679
[16,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[17,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[18,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[19,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[20,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[,15] [,16] [,17] [,18] [,19] [,20]
[1,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[2,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[3,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[4,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[5,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[6,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[7,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[8,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[9,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[10,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[11,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[12,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[13,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[14,] 0.2978679 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[15,] 0.9207258 0.3449256 0.0000000 0.0000000 0.0000000 0.0000000
[16,] 0.3449256 1.0664112 0.3083076 0.0000000 0.0000000 0.0000000
[17,] 0.0000000 0.3083076 1.0447204 0.3351461 0.0000000 0.0000000
[18,] 0.0000000 0.0000000 0.3351461 1.0166673 0.3076367 0.0000000
[19,] 0.0000000 0.0000000 0.0000000 0.3076367 0.9417494 0.2765948
[20,] 0.0000000 0.0000000 0.0000000 0.0000000 0.2765948 0.9815160
>
>
>
>
>
> dev.off()
null device
1
>