ggm_cfe: Gaussian Graphical Model with Ceiling/Floor Effect Correction

View source: R/ggmcfe.R

ggm_cfeR Documentation

Gaussian Graphical Model with Ceiling/Floor Effect Correction

Description

Estimates a psychological network (GGM) from data with ceiling and/or floor effects using a two-step pairwise censored-normal correction. Step 1 corrects item means and variances via truncated-normal moment matching (Liu & Wang, 2021). Step 2 estimates pairwise latent correlations by solving the moment equation E[cov*(rho)] = observed censored covariance, evaluated using 50-point Gauss-Hermite quadrature. The corrected covariance matrix is supplied as input to EBICglasso or significance-based edge selection, preserving the standard qgraph/bootnet workflow.

Usage

ggm_cfe(
  data,
  floor = NULL,
  ceiling = NULL,
  method = "EBICglasso",
  gamma = 0.5,
  nlambda = 100,
  lambda.min.ratio = 0.01,
  threshold = FALSE,
  alpha = 0.05,
  verbose = TRUE
)

Arguments

data

A data frame or numeric matrix (n x p). Rows = observations, columns = variables (items/nodes).

floor

Floor threshold(s). Either a single value applied to all variables, or a named numeric vector with one value per column. Use NULL to indicate no floor effect. Default: NULL.

ceiling

Ceiling threshold(s). Same format as floor. Default: NULL.

method

Estimation method(s): "EBICglasso" (default), "FDR", "Bonferroni", or "all" to run all three.

gamma

EBIC hyperparameter (0 = BIC, 0.5 = default). Only used when method includes "EBICglasso".

nlambda

Number of tuning parameters searched by EBICglasso. Default: 100.

lambda.min.ratio

Smallest lambda searched, as a fraction of the largest lambda. Passed to qgraph::EBICglasso. Default: 0.01.

threshold

Logical. Passed to qgraph::EBICglasso; TRUE enforces higher specificity at the cost of sensitivity. Default: FALSE.

alpha

Significance level for p-value methods. Default: 0.05.

verbose

Logical. Print progress and diagnostics. Default: TRUE.

Value

An object of class "ggm_cfe" containing:

network

Partial correlation matrix from the corrected method (primary estimator: EBICglasso or first specified method).

network_corrected

Partial correlation matrix from naive EBICglasso (ignoring ceiling/floor effects).

network_naive

Partial correlation matrix estimated from the raw (uncorrected) sample covariance using the primary method.

networks

Named list of partial correlation matrices for all requested methods.

networks_corrected

Partial correlation matrix from naive EBICglasso (ignoring ceiling/floor effects).

networks_naive

Named list of naive partial correlation matrices (one per requested method), estimated without ceiling/floor correction.

Sigma_corrected

The corrected covariance matrix (p x p).

Sigma_naive

The raw sample covariance matrix (p x p).

diagnostics

List with per-variable censoring statistics, nearPD correction magnitude, and floor/ceiling thresholds.

censoring

Data frame (p rows) with per-variable censoring statistics: variable, n_floor, n_ceil, pct_floor, pct_ceil, naive and corrected means (mu_naive, mu_corrected), and standard deviations (sd_naive, sd_corrected).

npd_correction

Relative Frobenius-norm magnitude of the nearest positive-definite projection applied to the corrected covariance matrix. Values above 0.05 suggest instability and should be interpreted cautiously.

a_vec

Length-p numeric vector of effective floor thresholds used internally (with NULL inputs replaced by data-driven lower bounds).

b_vec

Length-p numeric vector of effective ceiling thresholds (with NULL inputs replaced by data-driven upper bounds).

method

Character vector of estimation method(s) run.

gamma

EBIC hyperparameter value used.

nlambda

Number of regularization parameters searched.

lambda.min.ratio

Smallest lambda as a fraction of the largest.

threshold

Logical; whether EBICglasso hard-thresholding was applied.

alpha

Significance level for p-value methods.

n

The number of observations.

p

The number of variables.

varnames

The character vector of variable (column) names.

data

Original data matrix.

call

Matched call.

Examples

# Simulate data with ceiling effects
set.seed(42)
Y <- MASS::mvrnorm(200, rep(0,5), diag(5) + 0.3)
Y_cens <- pmin(Y, 1.0)   # ceiling at 1.0 SD
fit <- ggm_cfe(Y_cens, floor=NULL, ceiling=1.0)
print(fit)
plot(fit)

# With psych::bfi personality data
# library(psych)
# fit <- ggm_cfe(bfi[,1:25], floor=1, ceiling=6)

DACF documentation built on July 17, 2026, 1:07 a.m.