A wrapper function to estimate both intraindividiual
(level = "individual") and interindividual (level = "population")
structures using dynEGA
Usage
dynEGA.ind.pop(
data,
id = NULL,
n.embed = 5,
n.embed.optimize = FALSE,
tau = 1,
delta = 1,
use.derivatives = 1,
na.derivative = c("none", "kalman", "rowwise", "skipover"),
zero.jitter = 0.001,
corr = c("auto", "cor_auto", "pearson", "spearman"),
na.data = c("pairwise", "listwise"),
model = c("BGGM", "glasso", "TMFG"),
algorithm = c("leiden", "louvain", "walktrap"),
uni.method = c("expand", "LE", "louvain"),
ncores,
seed = NULL,
verbose = TRUE,
...
)Arguments
- data
Matrix or data frame. Participants and variable should be in long format such that row t represents observations for all variables at time point t for a participant. The next row, t + 1, represents the next measurement occasion for that same participant. The next participant's data should immediately follow, in the same pattern, after the previous participant
datashould have an ID variable labeled"ID"; otherwise, it is assumed that the data represent the populationFor groups,
datashould have a Group variable labeled"Group"; otherwise, it is assumed that there are no groups indataArguments
idandgroupcan be specified to tell the function which column indatait should use as the ID and Group variable, respectivelyA measurement occasion variable is not necessary and should be removed from the data before proceeding with the analysis
- id
Numeric or character (length = 1). Number or name of the column identifying each individual. Defaults to
NULL- n.embed
Numeric (length = 1 or more). Defaults to
5. Number of embedded dimensions (the number of observations to be used in theEmbedfunction). For example, an"n.embed = 5"will use five consecutive observations to estimate a single derivative.If more than one value is provided, then the number of embeddings will be optimized over using
tefito determine the optimal length of the embedding dimensions for each individual in the sample- n.embed.optimize
Boolean (length = 1). If
TRUE, performs optimization ofn.embedfor each individual, then constructs the population based on optimized derivatives. WhenTRUE, individual networks are considered of interest and will always be output. Defaults toFALSE- tau
Numeric (length = 1). Defaults to
1. Number of observations to offset successive embeddings in theEmbedfunction. Generally recommended to leave "as is"- delta
Numeric (length = 1). Defaults to
1. The time between successive observations in the time series (i.e, lag). Generally recommended to leave "as is"- use.derivatives
Numeric (length = 1). Defaults to
1. The order of the derivative to be used in the analysis. Available options:0— No derivatives; consistent with moving average1— First-order derivatives; interpreted as "velocity" or rate of change over time2— Second-order derivatives; interpreted as "acceleration" or rate of the rate of change over time
Generally recommended to leave "as is"
- na.derivative
Character (length = 1). How should missing data in the embeddings be handled? Available options (see Boker et al. (2018) in
gllareferences for more details):"none"(default) — does nothing and leavesNAs in data"kalman"— uses Kalman smoothing (KalmanSmooth) with structural time series models (StructTS) to impute missing values. This approach models the underlying temporal dependencies (trend, seasonality, autocorrelation) to generate estimates for missing observations while preserving the original time scale. More computationally intensive than the other methods but typically provides the most accurate imputation by respecting the stochastic properties of the time series"rowwise"— adjusts time interval with respect to each embedding ensuring time intervals are adaptive to the missing data (tends to be more accurate than"none")"skipover"— "skips over" missing data and treats the non-missing points as continuous points in time (note that the time scale shifts to the "per mean time interval," which is different and larger than the original scale)
- zero.jitter
Numeric (length = 1). Small amount of Gaussian noise added to zero variance derivatives to prevent estimation failures. For more than one variable, noise is generated multivariate normal distribution to ensure orthogonal noise is added. The jitter preserves the overall structure but avoids singular covariance matrices during network estimation. Defaults to
0.001- corr
Character (length = 1). Method to compute correlations. Defaults to
"auto". Available options:"auto"— Automatically computes appropriate correlations for the data using Pearson's for continuous, polychoric for ordinal, tetrachoric for binary, and polyserial/biserial for ordinal/binary with continuous. To change the number of categories that are considered ordinal, useordinal.categories(seepolychoric.matrixfor more details)"cor_auto"— Usescor_autoto compute correlations. Arguments can be passed along to the function"pearson"— Pearson's correlation is computed for all variables regardless of categories"spearman"— Spearman's rank-order correlation is computed for all variables regardless of categories
For other similarity measures, compute them first and input them into
datawith the sample size (n)- na.data
Character (length = 1). How should missing data be handled? Defaults to
"pairwise". Available options:"pairwise"— Computes correlation for all available cases between two variables"listwise"— Computes correlation for all complete cases in the dataset
- model
Character (length = 1). Defaults to
"glasso". Available options:"BGGM"— Computes the Bayesian Gaussian Graphical Model. Set argumentordinal.categoriesto determine levels allowed for a variable to be considered ordinal. See?BGGM::estimatefor more details"glasso"— Computes the GLASSO with EBIC model selection. SeeEBICglasso.qgraphfor more details"TMFG"— Computes the TMFG method. SeeTMFGfor more details
- algorithm
Character or
igraphcluster_*function (length = 1). Defaults to"walktrap". Three options are listed below but all are available (seecommunity.detectionfor other options):"leiden"— Seecluster_leidenfor more details"louvain"— By default,"louvain"will implement the Louvain algorithm using the consensus clustering method (seecommunity.consensusfor more information). This function will implementconsensus.method = "most_common"andconsensus.iter = 1000unless specified otherwise"walktrap"— Seecluster_walktrapfor more details
- uni.method
Character (length = 1). What unidimensionality method should be used? Defaults to
"louvain". Available options:"expand"— Expands the correlation matrix with four variables correlated 0.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 method was used in the Golino et al.'s (2020) Psychological Methods simulation"LE"— Applies the Leading Eigenvector algorithm (cluster_leading_eigen) on the empirical correlation matrix. If the number of dimensions is 1, then the Leading Eigenvector solution is used; otherwise, regular EGA is used. This method was used in the Christensen et al.'s (2023) Behavior Research Methods simulation"louvain"— Applies the Louvain algorithm (cluster_louvain) on the empirical correlation matrix. If the number of dimensions is 1, then the Louvain solution is used; otherwise, regular EGA is used. This method was validated Christensen's (2022) PsyArXiv simulation. Consensus clustering can be used by specifying either"consensus.method"or"consensus.iter"
- ncores
Numeric (length = 1). Number of cores to use in computing results. Defaults to
ceiling(parallel::detectCores() / 2)or half of your computer's processing power. Set to1to not use parallel computingIf you're unsure how many cores your computer has, then type:
parallel::detectCores()- seed
Numeric (length = 1). Defaults to
NULLor random results. Set for reproducible results. See Reproducibility and PRNG for more details on random number generation inEGAnet- verbose
Boolean (length = 1). Should progress be displayed? Defaults to
TRUE. Set toFALSEto not display progress- ...
Additional arguments to be passed on to
auto.correlate,network.estimation,community.detection,community.consensus, andEGA
Value
Same output as EGAnet{dynEGA} returning list
objects for level = "individual" and level = "population"
See also
plot.EGAnet for plot usage in EGAnet