Learn R Programming

EGAnet (version 1.2.3)

dynEGA.ind.pop: Dynamic EGA

Description

DynEGA estimates dynamic factors in multivariate time series (i.e. longitudinal data, panel data, intensive longitudinal data) at multiple time scales, in different levels of analysis: individuals (intraindividual structure) and population (structure of the population). Exploratory graph analysis is applied in the derivatives estimated using generalized local linear approximation (glla). Instead of estimating factors by modeling how variables are covarying, as in traditional EGA, dynEGA is a dynamic model that estimates the factor structure by modeling how variables are changing together. GLLA is a filtering method for estimating derivatives from data that uses time delay embedding and a variant of Savitzky-Golay filtering to accomplish the task.

Usage

dynEGA.ind.pop(
  data,
  n.embed,
  tau = 1,
  delta = 1,
  id = NULL,
  use.derivatives = 1,
  model = c("glasso", "TMFG"),
  model.args = list(),
  algorithm = c("walktrap", "leiden", "louvain"),
  algorithm.args = list(),
  corr = c("cor_auto", "pearson", "spearman"),
  uni.method = c("expand", "LE", "louvain"),
  ncores,
  progress = TRUE,
  ...
)

Arguments

data

A data frame with the variables to be used in the analysis. The data frame should be in a long format (i.e. observations for the same individual (for example, individual 1) are placed in order, from time 1 to time t, followed by the observations from individual 2, also ordered from time 1 to time t.)

n.embed

Integer. Number of embedded dimensions (the number of observations to be used in the Embed function). For example, an n.embed = 5 will use five consecutive observations to estimate a single derivative.

tau

Integer. Number of observations to offset successive embeddings in the Embed function. A tau of one uses adjacent observations. Default is tau = 1.

delta

Integer. The time between successive observations in the time series. Default is delta = 1.

id

Numeric. Number of the column identifying each individual.

use.derivatives

Integer. The order of the derivative to be used in the EGA procedure. Default to 1.

model

Character. A string indicating the method to use. Defaults to glasso. Current options are:

  • glasso Estimates the Gaussian graphical model using graphical LASSO with extended Bayesian information criterion to select optimal regularization parameter. This is the default method

  • TMFG Estimates a Triangulated Maximally Filtered Graph

model.args

List. A list of additional arguments for EBICglasso.qgraph or TMFG

algorithm

A string indicating the algorithm to use or a function from igraph Defaults to "walktrap". Current options are:

  • walktrap Computes the Walktrap algorithm using cluster_walktrap

  • leiden Computes the Leiden algorithm using cluster_leiden. Defaults to objective_function = "modularity"

  • louvain Computes the Louvain algorithm using cluster_louvain

algorithm.args

List. A list of additional arguments for cluster_walktrap, cluster_louvain, or some other community detection algorithm function (see examples)

corr

Type of correlation matrix to compute. The default uses cor_auto. Current options are:

  • cor_auto Computes the correlation matrix using the cor_auto function from qgraph.

  • pearson Computes Pearson's correlation coefficient using the pairwise complete observations via the cor function.

  • spearman Computes Spearman's correlation coefficient using the pairwise complete observations via the cor function.

uni.method

Character. What unidimensionality method should be used? Defaults to "LE". Current options are:

  • expand Expands the correlation matrix with four variables correlated .50. If number of dimension returns 2 or less in check, then the data are unidimensional; otherwise, regular EGA with no matrix expansion is used. This is the method used in the Golino et al. (2020) Psychological Methods simulation.

  • LE Applies the Leading Eigenvalue algorithm (cluster_leading_eigen) on the empirical correlation matrix. If the number of dimensions is 1, then the Leading Eigenvalue solution is used; otherwise, regular EGA is used. This is the final method used in the Christensen, Garrido, and Golino (2021) simulation.

  • louvain Applies the Louvain algorithm (cluster_louvain) on the empirical correlation matrix using a resolution parameter = 0.95. If the number of dimensions is 1, then the Louvain solution is used; otherwise, regular EGA is used. This method was validated in the Christensen (2022) simulation.

ncores

Numeric. Number of cores to use in computing results. Defaults to parallel::detectCores() / 2 or half of your computer's processing power. Set to 1 to not use parallel computing. Recommended to use maximum number of cores minus one

If you're unsure how many cores your computer has, then use the following code: parallel::detectCores()

progress

Boolean. Should progress be displayed? Defaults to TRUE. For Windows, FALSE is about 2x faster

...

Additional arguments. Used for deprecated arguments from previous versions of EGA

Author

Hudson Golino <hfg9s at virginia.edu>

Examples

Run this code
# Obtain data
sim.dynEGA <- sim.dynEGA # bypasses CRAN checks

if (FALSE) {
# Dynamic EGA individual and population structure
dyn.ega1 <- dynEGA.ind.pop(
  data = sim.dynEGA, n.embed = 5, tau = 1,
  delta = 1, id = 25, use.derivatives = 1,
  ncores = 2, corr = "pearson"
)}

Run the code above in your browser using DataLab