EBICglasso.qgraph: 'EBICglasso' from 'qgraph' 1.4.4

Description Usage Arguments Details Value Author(s) References Examples

View source: R/EBICglasso.qgraph.R

Description

This function uses the glasso package (Friedman, Hastie and Tibshirani, 2011) to compute a sparse gaussian graphical model with the graphical lasso (Friedman, Hastie & Tibshirani, 2008). The tuning parameter is chosen using the Extended Bayesian Information criterium (EBIC) described by Foygel & Drton (2010).

Usage

1
2
3
4
EBICglasso.qgraph(S, n, gamma = 0.5, penalize.diagonal = FALSE,
  nlambda = 100, lambda.min.ratio = 0.01, returnAllResults = FALSE,
  checkPD = TRUE, penalizeMatrix, countDiagonal = FALSE,
  refit = FALSE, ...)

Arguments

S

A covariance or correlation matrix

n

Sample size used in computing S

gamma

EBIC tuning parameter. 0.5 is generally a good choice. Setting to zero will cause regular BIC to be used.

penalize.diagonal

Should the diagonal be penalized?

nlambda

Number of lambda values to test.

lambda.min.ratio

Ratio of lowest lambda value compared to maximal lambda

returnAllResults

If TRUE this function does not return a network but the results of the entire glasso path.

checkPD

If TRUE, the function will check if S is positive definite and return an error if not. It is not advised to use a non-positive definite matrix as input as (a) that can not be a covariance matrix and (b) glasso can hang if the input is not positive definite.

penalizeMatrix

Optional logical matrix to indicate which elements are penalized

countDiagonal

Should diagonal be counted in EBIC computation? Defaults to FALSE. Set to TRUE to mimic qgraph < 1.3 behavior (not recommended!).

refit

Logical, should the optimal graph be refitted without LASSO regularization? Defaults to FALSE.

...

Arguments sent to glasso

Details

The glasso is run for 100 values of the tuning parameter logarithmically spaced between the maximal value of the tuning parameter at which all edges are zero, lambda_max, and lambda_max/100. For each of these graphs the EBIC is computed and the graph with the best EBIC is selected. The partial correlation matrix is computed using wi2net and returned.

Value

A partial correlation matrix

Author(s)

Sacha Epskamp <[email protected]>

References

Friedman, J., Hastie, T., & Tibshirani, R. (2008). Sparse inverse covariance estimation with the graphical lasso. Biostatistics, 9, 432-441. doi: 10.1093/biostatistics/kxm045

#glasso package Jerome Friedman, Trevor Hastie and Rob Tibshirani (2011). glasso: Graphical lasso-estimation of Gaussian graphical models. R package version 1.7. https://CRAN.R-project.org/package=glasso

Foygel, R., & Drton, M. (2010). Extended Bayesian information criteria for Gaussian graphical models. In Advances in neural information processing systems (pp. 604-612). https://papers.nips.cc/paper/4087-extended-bayesian-information-criteria-for-gaussian-graphical-models

#psych package Revelle, W. (2014) psych: Procedures for Personality and Psychological Research, Northwestern University, Evanston, Illinois, USA. R package version 1.4.4. https://CRAN.R-project.org/package=psych

#Matrix package Douglas Bates and Martin Maechler (2014). Matrix: Sparse and Dense Matrix Classes and Methods. R package version 1.1-3. https://CRAN.R-project.org/package=Matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
### Using wmt2 dataset from EGAnet ###
data(wmt2)

## Not run: 
# Compute correlations:
CorMat <- cor_auto(wmt2[,7:24])

# Compute graph with tuning = 0 (BIC):
BICgraph <- EBICglasso.qgraph(CorMat, nrow(wmt2), 0)

# Compute graph with tuning = 0.5 (EBIC)
EBICgraph <- EBICglasso.qgraph(CorMat, nrow(wmt2), 0.5)


## End(Not run)

hfgolino/EGA documentation built on Aug. 16, 2019, 2:50 a.m.