ggmFit: Obtain fit measures of a Gaussian graphical model

View source: R/ggmFit.R

ggmFitR Documentation

Obtain fit measures of a Gaussian graphical model

Description

Obtain fit measures of a given Gaussian graphical model (GGM). Input can be either a partial correlation matrix, inverse covariance matrix or qgraph object.

Usage

ggmFit(pcor, covMat, sampleSize, refit = TRUE, ebicTuning = 0.5, 
        nPar, invSigma, tol = sqrt(.Machine$double.eps), verbose = TRUE,
        countDiagonalPars = TRUE)

Arguments

pcor

Implied partial correlation matrix or qgraph object.

covMat

Observed variance-covariance matrix

sampleSize

The sample size used in computing the variance-covariance matrix

refit

Logical, should the network be refitted using glasso?

ebicTuning

EBIC tuning parameter.

invSigma

Implied inverse variance-covariance matrix. If this object is assigned pcor is not used.

nPar

Number of parameters, if not specified this is retrieved from the number of zeroes in the inverse variance–covariance matrix. Can be used to compute fit measures of any statistical model (e.g., SEM).

tol

Tolerance for setting an edge to zero.

verbose

Logical, should progress reports be printed to the console?

countDiagonalPars

Logical, should the diagonal of the precision matrix be counted as parameters?

Author(s)

Sacha Epskamp <mail@sachaepskamp.com>

Examples

library("psych")

# Load BFI data:
data(bfi)
bfi <- bfi[,1:25]

# Covariance matrix:
CovMat <- cov(bfi[,1:25], use="pairwise.complete.obs")

# Compute network:
EBICgraph <- qgraph(CovMat, graph = "glasso", sampleSize = nrow(bfi),
                    tuning = 0.5, layout = "spring", title = "BIC", details = TRUE)

# Obtain fit measures:
fitNetwork <- ggmFit(EBICgraph, CovMat, nrow(bfi))
fitNetwork

qgraph documentation built on Nov. 3, 2023, 5:07 p.m.

Related to ggmFit in qgraph...