Title: | Mixed Neighbourhood Selection |
---|---|
Description: | An implementation of the mixed neighbourhood selection (MNS) algorithm. The MNS algorithm can be used to estimate multiple related precision matrices. In particular, the motivation behind this work was driven by the need to understand functional connectivity networks across multiple subjects. This package also contains an implementation of a novel algorithm through which to simulate multiple related precision matrices which exhibit properties frequently reported in neuroimaging analysis. |
Authors: | Ricardo Pio Monti, Christoforos Anagnostopoulos and Giovanni Montana |
Maintainer: | Ricardo Pio Monti <[email protected]> |
License: | GPL-2 |
Version: | 1.0 |
Built: | 2025-01-31 03:40:26 UTC |
Source: | https://github.com/cran/MNS |
An R package for estimating multiple, related grapical models using the Mixed Neighbourhood Selection algorithm. This package also includes two algorithm through which to simulate multiple, related graphical models which demonstrate some of the properties reported through empirical studies of functional connectivity networks.
Package: | MNS |
Type: | Package |
Version: | 1.0 |
Date: | 2015-10-14 |
License: | GPL-2 |
Ricardo Pio Monti
Monti, R., Anagnostopolus, C., Montana, G. "Inferring brain connectivity networks from functional MRI data via mixed neighbourhood selection", arXiv, 2015
MNS
, cv.MNS
, plot.MNS
, gen.Network
set.seed(1) N=4 Net = gen.Network(method = "cohort", p = 10, Nsub = N, sparsity = .2, REsize = 20, REprob = .5, REnoise = 1, Nobs = 10) ## Not run: # plot simulated networks: plot(Net, view="pop") # run MNS algorithm: mns = MNS(dat = Net$Data, lambda_pop = .1, lambda_random = .1, parallel = TRUE) # plot results from MNS algorithm: plot(mns) # plot population network plot(mns, view="var") # plot variance network plot(mns, view="sub") # plot subject networks (note red edges here are variable edges!) ## End(Not run)
set.seed(1) N=4 Net = gen.Network(method = "cohort", p = 10, Nsub = N, sparsity = .2, REsize = 20, REprob = .5, REnoise = 1, Nobs = 10) ## Not run: # plot simulated networks: plot(Net, view="pop") # run MNS algorithm: mns = MNS(dat = Net$Data, lambda_pop = .1, lambda_random = .1, parallel = TRUE) # plot results from MNS algorithm: plot(mns) # plot population network plot(mns, view="var") # plot variance network plot(mns, view="sub") # plot subject networks (note red edges here are variable edges!) ## End(Not run)
Select regularization parameters via K-fold cross-validation
cv.MNS(dat, l1range, alpharange, K = 5, parallel = FALSE, cores = NULL, verbose = FALSE)
cv.MNS(dat, l1range, alpharange, K = 5, parallel = FALSE, cores = NULL, verbose = FALSE)
dat |
List where each entry corresponds to the time series observations for each subject |
l1range |
Vector of candidate regularization parameters. See details below |
alpharange |
Vector of candidate weighting parameters. See details below. |
K |
Number of cross-validation folds |
parallel |
Indicate whether model fit should be done in parallel. Default is FALSE |
cores |
If fit in parallel, indicate how many units/cores should be used |
verbose |
Print progress. Only available for non-parallel implementation |
Select regularization parameters via cross-validation. In the interest of simplicity we re-parameterize penalty as an elastic net penalty:
Thus is the regularization parameter (specified by the
l1range
argument)
and is the weighting parameter (specified by the
alpharange
argument).
l1 |
selected regularization parameter |
alpha |
selected weighting parameter |
CV |
grid of cross-validation error for each pair of regularization parameters |
Ricardo Pio Monti
Arlot, S., and Alain C. "A survey of cross-validation procedures for model selection." Statistics surveys 4 (2010): 40-79.
Monti, R., Anagnostopolus, C., Montana, G. "Inferring brain connectivity networks from functional MRI data via mixed neighbourhood selection", arXiv, 2015
set.seed(1) Dat = gen.Network(p = 10, Nsub = 5, sparsity = .2, REsize=10, REprob=.5, REnoise = 1, Nobs=20) ## Not run: CVs = cv.MNS(dat = Dat, l1range = seq(.1, .5, length.out=10), alpharange = seq(.2, .8, length.out = 5), parallel = FALSE, verbose = TRUE) ## End(Not run)
set.seed(1) Dat = gen.Network(p = 10, Nsub = 5, sparsity = .2, REsize=10, REprob=.5, REnoise = 1, Nobs=20) ## Not run: CVs = cv.MNS(dat = Dat, l1range = seq(.1, .5, length.out=10), alpharange = seq(.2, .8, length.out = 5), parallel = FALSE, verbose = TRUE) ## End(Not run)
Implementations of two methods through which to simulation multiple related networks. The first simulates networks from a three-class population described in Danaher et al. (2014). The second simulates networks according to method proposed in Monti et al. (2015). For further details see the package vignette.
gen.Network(method = "cohort", p, Nobs, Nsub, sparsity, REsize, REprob, REnoise)
gen.Network(method = "cohort", p, Nobs, Nsub, sparsity, REsize, REprob, REnoise)
method |
Network simulation method. One of either "Danaher" for the three-class method of Danaher et al. (2014) or "cohort" for the cohort method described in Monti et al. (2015) |
p |
Number of nodes in network (i.e., this will be dimensionality of the resulting precision matrices) |
Nobs |
Number of observations per subject (assumed constant across subjects). If this is missing then only the precision matrices will be returned (i.e., random data is not simulated) |
Nsub |
Number of subjects for which to simulate networks. Note that this is set to 3 if method="Danaher" |
sparsity |
Sparsity level of precision matrices |
REsize |
Number of random effects edges to add to each subject (only for method="cohort") |
REprob |
Probability with which a random edge added to each subject (only for method="cohort") |
REnoise |
Variability of random edges (only for method="cohort") |
See package vignette for further details. Alternatively see Danaher et al. (2014) or Monti et al. (2015)
Networks |
List containing simulated netowrks where ith entry is the ith random network for the ith subject |
Data |
List where ith entry is simulated data for ith subject |
PopNet |
Population precision matrix (only if method="cohort") |
RanNet |
Sparse support for random edges (only if method="cohort") |
Ricardo Pio Monti
Danaher, P., Wang, P. , and Witten, D. "The joint graphical lasso for inverse covariance estimation across multiple classes." Journal of the Royal Statistical Society: Series B (Statistical Methodology) 76.2 (2014): 373-397.
Monti, R., Anagnostopolus, C., Montana, G. "Inferring brain connectivity networks from functional MRI data via mixed neighbourhood selection", arXiv, 2015
# generate data according to cohort model of Monti et al. (2015) set.seed(1) Dat = gen.Network(p = 10, Nsub = 5, sparsity = .2, REsize=10, REprob=.5, REnoise = 1, Nobs=20) ## Not run: # plot simulated networks: plot(Net, view="pop") ## End(Not run)
# generate data according to cohort model of Monti et al. (2015) set.seed(1) Dat = gen.Network(p = 10, Nsub = 5, sparsity = .2, REsize=10, REprob=.5, REnoise = 1, Nobs=20) ## Not run: # plot simulated networks: plot(Net, view="pop") ## End(Not run)
Estimate multiple related graphical models using the mixed neighbourhood selection (MNS) algorithm.
MNS(dat, lambda_pop, lambda_random, parallel = FALSE, cores = NULL, max_iter = 100, tol = 1e-05)
MNS(dat, lambda_pop, lambda_random, parallel = FALSE, cores = NULL, max_iter = 100, tol = 1e-05)
dat |
List where each entry corresponds to the time series observations for each subject |
lambda_pop |
Regularization parameter applied to fixed effects components. See details below for more information |
lambda_random |
Regularization parameter applied to the standard deviations of random effect effects. See details below for more information |
parallel |
Indicate whether model fit should be done in parallel. Default is FALSE |
cores |
If fit in parallel, indicate how many cores should be used |
max_iter |
Maximum number of iterations in EM algorithm. See details below for more information |
tol |
Convergence tolerance in EM algorithm |
The MNS algorithm is an extension of neighbourhood selection to the scenario where the objective is to learn multiple related Gaussian graphical models. For further details see Monti et al. (2015).
PresPop |
Population connectivity matrix - encodes the sparse support structure of population precision |
PresRE |
Network of highly variable edges - encodes the sparse support structure of highly variable edges |
PresBLUP |
Array containing predicted subject specific deviations from population connectivity. |
it |
Iterations to fit MNS model (one per node) |
Ricardo Pio monti
Monti, R., Anagnostopolus, C., Montana, G. "Inferring brain connectivity networks from functional MRI data via mixed neighbourhood selection", arXiv, 2015
set.seed(1) N=4 Net = gen.Network(method = "cohort", p = 10, Nsub = N, sparsity = .2, REsize = 20, REprob = .5, REnoise = 1, Nobs = 10) ## Not run: mns = MNS(dat = Net$Data, lambda_pop = .1, lambda_random = .1, parallel = TRUE) # plot results: plot(mns) # plot population network plot(mns, view="var") # plot variance network plot(mns, view="sub") # plot subject networks (note red edges here are variable edges!) ## End(Not run)
set.seed(1) N=4 Net = gen.Network(method = "cohort", p = 10, Nsub = N, sparsity = .2, REsize = 20, REprob = .5, REnoise = 1, Nobs = 10) ## Not run: mns = MNS(dat = Net$Data, lambda_pop = .1, lambda_random = .1, parallel = TRUE) # plot results: plot(mns) # plot population network plot(mns, view="var") # plot variance network plot(mns, view="sub") # plot subject networks (note red edges here are variable edges!) ## End(Not run)
Plotting function for MNS objects. This function implements plotting for either population networks, high variable networks or subject-specific networks.
## S3 method for class 'MNS' plot(x, view="pop", subID=NULL, ...)
## S3 method for class 'MNS' plot(x, view="pop", subID=NULL, ...)
x |
MNS object |
view |
Plotting view. This argument defines which networks are plotted. Three options are "pop": plot population network, "var": plot network of variable edges, "sub": plot subject-specific networks |
subID |
If view="sub", subID indicates which subjects networks should be plotted. |
... |
Additional arguments to pass to plot function |
Plotting function for MNS objects. Can be used to plot simulated networks or results obtained from running
MNS algorithm.
Note that if networks are simulated using the "Danaher"
method then only subject-specific networks can be plotted (i.e., we require view="sub"
)
Ricardo Pio monti
Monti, R., Anagnostopolus, C., Montana, G. "Inferring brain connectivity networks from functional MRI data via mixed neighbourhood selection", arXiv, 2015
set.seed(1) N=4 Net = gen.Network(method = "cohort", p = 10, Nsub = N, sparsity = .2, REsize = 20, REprob = .5, REnoise = 1, Nobs = 10) ## Not run: # can plot simulated networks: plot.MNS(Net, view="pop") # can also plot results from MNS algorithm: mns = MNS(dat = Net$Data, lambda_pop = .1, lambda_random = .1, parallel = TRUE) plot.MNS(mns) # plot population network plot.MNS(mns, view="var") # plot variance network plot.MNS(mns, view="sub") # plot subject networks (note red edges here are variable edges!) ## End(Not run)
set.seed(1) N=4 Net = gen.Network(method = "cohort", p = 10, Nsub = N, sparsity = .2, REsize = 20, REprob = .5, REnoise = 1, Nobs = 10) ## Not run: # can plot simulated networks: plot.MNS(Net, view="pop") # can also plot results from MNS algorithm: mns = MNS(dat = Net$Data, lambda_pop = .1, lambda_random = .1, parallel = TRUE) plot.MNS(mns) # plot population network plot.MNS(mns, view="var") # plot variance network plot.MNS(mns, view="sub") # plot subject networks (note red edges here are variable edges!) ## End(Not run)