The goal of netDFI is to compute dynamic fit index (DFI) cutoffs for network models.
The reference of DFI for Gaussian graphical models: https://osf.io/preprints/psyarxiv/5wj2y_v1
You can install the development version of netDFI from GitHub with:
# install.packages("devtools")
# devtools::install_github("xinkaidupsy/netDFI")
install.packages("netDFI", repos = c('https://xinkaidupsy.r-universe.dev', 'https://cloud.r-project.org'))
This is a basic example which shows you how to solve a common problem:
library(psych)
library(psychonetrics)
library(dplyr)
library(netDFI)
# get the big five inventory data from psych
data(bfi)
# estimate ggm
bfi_mod <- ggm(bfi) %>% prune %>% runmodel
# obtain the partial correlation matrix
bfi_net <- getmatrix(bfi_mod, "omega")
# allow future_apply to use more memory
options(future.globals.maxSize = 2 * 1024^3)
# run dfi
dfi_bfi <- dfi_ggm(
bfi_net,
ncores = 1,
specificity = 0.80,
iter = 200,
n_misspec = 2
)
dfi_bfi
# plot results
p <- plot(dfi_bfi)
p[[1]]