MGL: Module network inference

Description Usage Arguments Value Examples

View source: R/MGL.R

Description

Takes a high-dimensional data matrix, initial values of the module latent variables, and a penalty parameter, and returns the final assignment of the data points to the modules, the values of the module latent variables, and the conditional dependency network among the module latent variables.

Usage

1
MGL(data, L, lambda, printoutput = 0, maxiter = 100, threshold = 0.01)

Arguments

data

An nxp matrix which contains n samples from p variables, where typically p>>n

L

An nxk matrix which contains the initial latent variable values, a column for each module

lambda

A penalty parameter controlling the sparsity of the conditional dependency network among the modules

printoutput

1 if the user wants the output from each iteration to be displayed, 0 for silent run

maxiter

Maximum number of iterations to be performed

threshold

Threshold for convergence

Value

L

An nxk matrix which contains the final latent variable values, a column for each module

theta

A kxk symmetric positive-semidefinite matrix respresenting the conditional dependency network among the modules

Z

A p-vector containing values between 1 to k, representing the assignment of the p variables to k modules

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
library(MGL)
n = 20 #sample size
p = 100 #variable size
k = 5 #module size
lambda = .01 #penalty parameter to induce sparsity
data = matrix(rnorm(n*p), ncol=p)
# to start with initial random module latent variables
L = matrix(rnorm(n*k), ncol=k)
MGL(data, L, lambda)
# to start with k-means cluster centroids as module latent variables
L = t(kmeans(t(data), k)$centers)
MGL(data, L, lambda)

## End(Not run)

Example output

$L
              [,1]        [,2]        [,3]         [,4]         [,5]
 [1,]  0.065985900 -0.10994705  0.18968118 -0.002444374  0.152631596
 [2,]  0.519741112  0.15428774 -0.47236383  0.444131722 -0.004330232
 [3,]  0.561965748 -0.34571267 -0.12982628 -0.127936276  0.011401763
 [4,] -0.060662924  0.20697618 -0.18833723 -0.240796944  0.258187340
 [5,] -0.448130135 -0.10426775  0.03327597 -0.157302242  0.056876829
 [6,]  0.069914897  0.12830753  0.13375113  0.041594802 -0.116276989
 [7,] -0.317607942 -0.15040364  0.35563519 -0.304017734  0.103715765
 [8,]  0.027632474  0.54809314 -0.09428134 -0.624184172 -0.019306193
 [9,] -0.042168542  0.03586131 -0.18271092 -0.005992714 -0.012063559
[10,] -0.203113400  0.25728039  0.42419598 -0.584072619 -0.085267086
[11,] -0.196574905 -0.26536624  0.18305737  0.121533247  0.058019434
[12,]  0.009327154  0.05032727 -0.28139280 -0.077235267  0.022258017
[13,] -0.392590581  0.08938219  0.34488776  0.223235553  0.029488306
[14,] -0.160175231 -0.40865862  0.39857834 -0.250538673  0.046423334
[15,] -0.037732630 -0.45606974  0.36803757 -0.091135731  0.038712549
[16,]  0.126513076  0.33975780 -0.48012763 -0.040205396  0.061406681
[17,] -0.193500111 -0.17666197  0.46659282 -0.362067748 -0.023941664
[18,] -0.092076686 -0.10735821  0.32574788  0.254915978 -0.017420289
[19,] -0.003051776 -0.44362021  0.11779685  0.081029296  0.007277365
[20,]  0.300855738  0.02220916 -0.17154681 -0.042697782  0.026145286

$theta
          [,1]      [,2]      [,3]      [,4]    [,5]
[1,] 15.990555  0.000000  6.259901 -1.020372  0.0000
[2,]  0.000000 13.402345  3.948230  1.609429  0.0000
[3,]  6.259900  3.948230 13.738734  1.412712  0.0000
[4,] -1.020368  1.609433  1.412715 13.043791  0.0000
[5,]  0.000000  0.000000  0.000000  0.000000 60.9878

$Z
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
[1,]    5    1    5    5    1    2    2    4    5     3     1     1     3     4
     [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26]
[1,]     5     1     4     4     5     5     2     2     5     3     2     3
     [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38]
[1,]     2     5     2     3     3     3     2     3     3     5     5     2
     [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50]
[1,]     2     2     4     1     2     4     1     3     5     3     1     3
     [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [,61] [,62]
[1,]     4     1     5     1     1     1     4     3     3     4     1     5
     [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [,71] [,72] [,73] [,74]
[1,]     2     4     1     2     1     4     5     1     2     1     3     3
     [,75] [,76] [,77] [,78] [,79] [,80] [,81] [,82] [,83] [,84] [,85] [,86]
[1,]     5     5     2     2     3     4     2     5     5     4     3     5
     [,87] [,88] [,89] [,90] [,91] [,92] [,93] [,94] [,95] [,96] [,97] [,98]
[1,]     1     5     3     3     3     2     3     2     3     4     4     3
     [,99] [,100]
[1,]     4      4

$L
             [,1]        [,2]        [,3]         [,4]        [,5]
 [1,]  0.25494475 -0.11046021  0.18122553  0.063439627  0.08549681
 [2,] -0.19257443  0.46946620  0.16831998  0.028714713  0.12930545
 [3,] -0.26764080 -0.25597938  0.48490157 -0.387156439  0.52394112
 [4,] -0.21562794 -0.20935185  0.45172629 -0.199451849  0.50720745
 [5,]  0.08168064  0.10536662  0.26704888 -0.343336897 -0.53164601
 [6,]  0.32534551 -0.54680865 -0.26359608  0.189599088  0.21295715
 [7,] -0.27880680  0.12299151 -0.14229353  0.259471868 -0.04143980
 [8,] -0.54438595 -0.04978158  0.16570807  0.318817730 -0.03486373
 [9,] -0.72372702  0.13327832 -0.19926064  0.385529497  0.11168252
[10,]  0.68050349 -0.79943317 -0.26310827 -0.095253809  0.13789118
[11,]  0.53698069 -0.10606117 -0.64352361 -0.169835353  0.30958454
[12,] -0.24928764  0.14587913 -0.07237650  0.004545797 -0.09847205
[13,]  0.17146610  0.59620231 -0.44712009 -0.096395987  0.31937510
[14,]  0.17081777 -0.25795432 -0.63495135  0.213543817  0.14258392
[15,] -0.10494809 -0.17161716 -0.09875534 -0.101962115  0.46048262
[16,] -0.09533873 -0.27637766  0.26219202 -0.186505099  0.26740596
[17,]  0.24394967 -0.50267508 -0.42369468  0.414532289 -0.18261635
[18,]  0.18900482  0.14620906 -0.01601017  0.142261361 -0.08890176
[19,]  0.22237079 -0.30090459  0.47933560 -0.481916037 -0.07291382
[20,] -0.18325738  0.04565754  0.10445782  0.285746573 -0.17421670

$theta
         [,1]      [,2]     [,3]      [,4]       [,5]
[1,] 9.915211 2.9750608 3.407036  3.161608  0.0000000
[2,] 2.975057 9.3792695 0.000000  0.000000  0.1906305
[3,] 3.407041 0.0000000 9.880113  4.888929  0.0000000
[4,] 3.161609 0.0000000 4.888928 15.521753  1.2821712
[5,] 0.000000 0.1906306 0.000000  1.282171 12.8016957

$Z
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
[1,]    3    3    3    4    4    1    1    2    5     1     5     3     5     2
     [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26]
[1,]     4     5     2     3     5     1     4     4     1     1     5     5
     [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38]
[1,]     5     5     2     1     1     1     4     4     1     4     5     3
     [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50]
[1,]     4     2     1     3     2     2     3     4     5     4     5     4
     [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [,61] [,62]
[1,]     3     3     1     4     3     5     2     1     5     2     3     3
     [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [,71] [,72] [,73] [,74]
[1,]     4     2     5     5     3     1     2     1     5     4     4     4
     [,75] [,76] [,77] [,78] [,79] [,80] [,81] [,82] [,83] [,84] [,85] [,86]
[1,]     5     5     4     3     5     4     4     2     2     1     1     4
     [,87] [,88] [,89] [,90] [,91] [,92] [,93] [,94] [,95] [,96] [,97] [,98]
[1,]     4     3     1     4     1     3     1     4     5     5     1     1
     [,99] [,100]
[1,]     2      2

MGL documentation built on May 2, 2019, 1:08 p.m.

Related to MGL in MGL...