Learn R Programming

EGAnet (version 0.9.6)

dynEGA: Dynamic Exploratory Graph Analysis

Description

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), groups or 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(
  data,
  n.embed,
  tau = 1,
  delta = 1,
  level = c("individual", "group", "population"),
  id = NULL,
  group = NULL,
  use.derivatives = 1,
  model = c("glasso", "TMFG"),
  algorithm = c("walktrap", "louvain"),
  plot.EGA = TRUE,
  cor = c("cor_auto", "pearson", "spearman"),
  steps = 4,
  ncores
)

Arguments

data

A dataframe with the variables to be used in the analysis. The dataframe 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".

level

Character. A string indicating the level of analysis. If the interest is in modeling the intraindividual structure only (one dimensionality structure per individual), then level should be set to "individual". If the interest is in the structure of a group of individuals, then level should be set to "group". Finally, if the interest is in the population structure, then level should be set to "population".

Current options are:

  • individual Estimates the dynamic factors per individual. This should be the prefered method is one is interested in in the factor structure of individuals. An additional parameter ("id") needs to be provided identifying each individual.

  • group Estimates the dynamic factors for each group. An additional parameter ("group") needs to be provided identifying the group membership.

  • population Estimates the dynamic factors of the population

id

Numeric. Number of the column identifying each individual.

group

Numeric or character. Number of the column identifying group membership. Must be specified only if level = "group".

use.derivatives

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

model

A string indicating the network method to use (EGA.estimate). 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

algorithm

A string indicating the community detection algorithm to use. Current options are:

plot.EGA

Logical. If TRUE, returns a plot of the network and its estimated dimensions. Defaults to TRUE

cor

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.

steps

Number of steps to be used in cluster_walktrap algorithm. Defaults to 4.

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()

References

Boker, S. M., Deboeck, P. R., Edler, C., & Keel, P. K. (2010) Generalized local linear approximation of derivatives from time series. In S.-M. Chow, E. Ferrer, & F. Hsieh (Eds.), The Notre Dame series on quantitative methodology. Statistical methods for modeling human dynamics: An interdisciplinary dialogue, (p. 161-178). Routledge/Taylor & Francis Group. doi:10.1037/a0016622

Deboeck, P. R., Montpetit, M. A., Bergeman, C. S., & Boker, S. M. (2009) Using derivative estimates to describe intraindividual variability at multiple time scales. Psychological Methods, 14(4), 367-386. doi:10.1037/a0016622

Golino, H. F., & Epskamp, S. (2017). Exploratory graph analysis: A new approach for estimating the number of dimensions in psychological research. PloS one, 12(6), e0174035.. doi: journal.pone.0174035 Savitzky, A., & Golay, M. J. (1964). Smoothing and differentiation of data by simplified least squares procedures. Analytical Chemistry, 36(8), 1627-1639. doi:10.1021/ac60214a047

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# Population structure:
dyn.random <- dynEGA(data = sim.dynEGA, n.embed = 5, tau = 1,
delta = 1, id = 21, group = 22, use.derivatives = 1,
level = "population", model = "glasso", ncores = 2)


# Group structure:
dyn.group <- dynEGA(data = sim.dynEGA, n.embed = 5, tau = 1,
delta = 1, id = 21, group = 22, use.derivatives = 1,
level = "group", model = "glasso", ncores = 2)

# Intraindividual structure:

dyn.individual <- dynEGA(data = sim.dynEGA, n.embed = 5, tau = 1,
delta = 1, id = 21, group = 22, use.derivatives = 1,
level = "individual", model = "glasso", ncores = 2)
# }

Run the code above in your browser using DataLab