Estimates person-specific directed networks from intensive longitudinal data using the unified Structural Equation Modeling (uSEM) framework. Implements a data-driven search that identifies:
Group-level paths: Directed edges present for a majority (default 75%) of individuals.
Individual-level paths: Additional edges specific to each person, found after group paths are established.
Estimation is delegated to idiographic::fit_gimme(), the clean-room home
of the temporal idiographic estimators, whose search reproduces the
upstream gimme package (>= 10.0) exactly (verified at tolerance 0 on
path counts and per-person coefficient matrices in idiographic's own
parity suite). Uses lavaan for SEM estimation and modification
indices. Accepts a single data frame with an ID column (not CSV
directories).
Usage
build_gimme(
data,
vars,
id,
time = NULL,
ar = TRUE,
standardize = FALSE,
groupcutoff = 0.75,
subcutoff = 0.5,
paths = NULL,
exogenous = NULL,
hybrid = FALSE,
rmsea_cutoff = 0.05,
srmr_cutoff = 0.05,
nnfi_cutoff = 0.95,
cfi_cutoff = 0.95,
n_excellent = 2L,
seed = NULL
)Arguments
- data
A
data.framein long format with columns for person ID, time-varying variables, and optionally a time/beep column.- vars
Character vector of variable names to model.
- id
Character string naming the person-ID column.
- time
Character string naming the time/order column, or
NULL. When provided, data is sorted byidthentimebefore lagging.- ar
Logical. If
TRUE(default), autoregressive paths (each variable predicting itself at lag 1) are included as fixed paths.- standardize
Logical. If
TRUE(defaultFALSE), variables are standardized per person before estimation.- groupcutoff
Numeric between 0 and 1. Proportion of individuals for whom a path must be significant to be added at group level. Default
0.75.- subcutoff
Numeric. Not used (reserved for future subgrouping); accepted for API compatibility and not forwarded to
idiographic::fit_gimme(), which does not implement subgrouping either. Default0.50.- paths
Character vector of lavaan-syntax paths to force into the model (e.g.,
"V2~V1lag"). DefaultNULL.- exogenous
Character vector of variable names to treat as exogenous. Default
NULL.- hybrid
Logical. If
TRUE, also searches residual covariances. DefaultFALSE.- rmsea_cutoff
Numeric. RMSEA threshold for excellent fit (default 0.05).
- srmr_cutoff
Numeric. SRMR threshold for excellent fit (default 0.05).
- nnfi_cutoff
Numeric. NNFI/TLI threshold for excellent fit (default 0.95).
- cfi_cutoff
Numeric. CFI threshold for excellent fit (default 0.95).
- n_excellent
Integer. Number of fit indices that must be excellent to stop individual search. Default
2.- seed
Integer or
NULL. Random seed for reproducibility.
Value
The object returned by idiographic::fit_gimme(): an S3 object of
class c("net_gimme", "cograph_network", "list"). It is a
superset of the pre-0.9.0 in-package field contract – every
element below is present, alongside idiographic's own additions
(contemp_cov, contemp_cov_avg, contemp_is_cov).
Elements:
temporalp x p matrix of group-level temporal (lagged) path counts – entry
[i,j]= number of individuals with path j(t-1)->i(t).contemporaneousp x p matrix of group-level contemporaneous path counts – entry
[i,j]= number of individuals with path j(t)->i(t).temporal_avg,contemporaneous_avgp x p group-average coefficient matrices.
coefsList of per-person p x 2p coefficient matrices (rows = endogenous, cols =
[lagged, contemporaneous]).psiList of per-person residual covariance matrices.
fitData frame of per-person fit indices (chisq, df, pvalue, rmsea, srmr, nnfi, cfi, bic, aic, logl, status).
path_countsp x 2p matrix: how many individuals have each path.
pathsList of per-person character vectors of lavaan path syntax.
group_pathsCharacter vector of group-level paths found.
individual_pathsList of per-person character vectors of individual-level paths (beyond group).
syntaxList of per-person full lavaan syntax strings.
labelsCharacter vector of variable names.
n_subjectsInteger. Number of individuals.
n_obsInteger vector. Time points per individual.
configList of configuration parameters.
The object additionally carries idiographic's netobject fields
(weights, nodes, edges, directed,
data, meta, node_groups) so it renders directly with
cograph. print(), summary() and plot() dispatch to
idiographic's methods, not to Nestimate's: in particular
summary() returns a tidy data.frame rather than printing.
Results changed in 0.9.0
Before 0.9.0 the search ran in an in-package implementation that was
not upstream-gimme-exact. Delegating to
idiographic::fit_gimme() changed which paths the search selects on the
same data – individual-level paths in particular – so numeric results
are not comparable with Nestimate <= 0.8.5. The returned object also
gained fields (see Value); nothing was removed.
Examples
# \donttest{
# Create simple panel data (3 subjects, 4 variables, 30 time points).
set.seed(42)
n_sub <- 3; n_t <- 30; vars <- paste0("V", 1:4)
rows <- lapply(seq_len(n_sub), function(i) {
d <- as.data.frame(matrix(rnorm(n_t * 4), ncol = 4))
names(d) <- vars; d$id <- i; d
})
panel <- do.call(rbind, rows)
res <- build_gimme(panel, vars = vars, id = "id")
print(res)
#> GIMME Network Analysis
#> ------------------------------
#> Subjects: 3
#> Variables: 4 ( V1, V2, V3, V4 )
#> AR paths: yes
#> Hybrid: no
#>
#> Group-level paths found: 0
#>
#> Individual-level paths: mean 0.3, range 0-1
#>
#> Proportion of subjects with each path:
#>
#> Temporal [directed]
#> weights [1.000, 1.000] | +4 / -0 edges
#> V1 V2 V3 V4
#> V1 1 0 0 0
#> V2 0 1 0 0
#> V3 0 0 1 0
#> V4 0 0 0 1
#>
#> Contemporaneous [directed]
#> weights [0.333, 0.333] | +1 / -0 edges
#> V1 V2 V3 V4
#> V1 0 0 0 0.33
#> V2 0 0 0 0.00
#> V3 0 0 0 0.00
#> V4 0 0 0 0.00
#>
#> plot(x) (faithful gimme-style mixed network) | plot(x, layer = "temporal")
#> edges(x) | nodes(x) | summary(x) | coefs(x) | matrices(x)
# }