Obtain fit measures of a given Gaussian graphical model (GGM). Input can be either a partial correlation matrix, inverse covariance matrix or qgraph
object.
ggmFit(pcor, covMat, sampleSize, refit = TRUE, ebicTuning = 0.5,
nPar, invSigma, tol = sqrt(.Machine$double.eps), verbose = TRUE,
countDiagonalPars = TRUE)
Implied partial correlation matrix or qgraph
object.
Observed variance-covariance matrix
The sample size used in computing the variance-covariance matrix
Logical, should the network be refitted using glasso
?
EBIC tuning parameter.
Implied inverse variance-covariance matrix. If this object is assigned pcor
is not used.
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).
Tolerance for setting an edge to zero.
Logical, should progress reports be printed to the console?
Logical, should the diagonal of the precision matrix be counted as parameters?
Sacha Epskamp <mail@sachaepskamp.com>
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
Run the code above in your browser using DataLab