Learn R Programming

gimme (version 0.7-18)

indSEM: Individual-level structural equation model search.

Description

This function identifies structural equation models for each individual. It does not utilize any shared information from the sample.

Usage

indSEM(data   = NULL,
       out    = NULL,
       sep    = NULL,
       header = NULL,
       ar     = TRUE,
       plot   = TRUE,
       paths  = NULL,
       exogenous        = NULL, 
       outcome          = NULL, 
       conv_vars        = NULL,
       conv_length      = 16, 
       conv_interval    = 1,
       mult_vars        = NULL,
       mean_center_mult = FALSE,
       standardize      = FALSE,
       hybrid = FALSE,
       VAR    = FALSE)

Arguments

data

The path to the directory where the data files are located, or the name of the list containing each individual's time series. Each file or matrix must contain one matrix for each individual containing a T (time) by p (number of variables) matrix where the columns represent variables and the rows represent time.

out

The path to the directory where the results will be stored (optional). If specified, a copy of output files will be replaced in directory. If directory at specified path does not exist, it will be created.

sep

The spacing of the data files. "" indicates space-delimited, "/t" indicates tab-delimited, "," indicates comma delimited. Only necessary to specify if reading data in from physical directory.

header

Logical. Indicate TRUE for data files with a header. Only necessary to specify if reading data in from physical directory.

ar

Logical. If TRUE, begins search for individual models with autoregressive (AR) paths open. Defaults to TRUE.

plot

Logical. If TRUE, graphs depicting relations among variables of interest will automatically be created. Defaults to TRUE. For individual- level plots, red paths represent positive weights and blue paths represent negative weights.

paths

lavaan-style syntax containing paths with which to begin model estimation. That is, Y~X indicates that Y is regressed on X, or X predicts Y. Paths can also be set to a specific value for estimation using lavaan-style syntax (e.g., 'V4 ~ 0.5*V3'), or set to 0 so that they will not be estimated (e.g., 'V4 ~ 0*V3'). If no header is used, then variables should be referred to with V followed (with no separation) by the column number. If a header is used, variables should be referred to using variable names. To reference lag variables, "lag" should be added to the end of the variable name with no separation. Defaults to NULL.

exogenous

Vector of variable names to be treated as exogenous. That is, exogenous variable X can predict Y but cannot be predicted by Y. If no header is used, then variables should be referred to with V followed (with no separation) by the column number. If a header is used, variables should be referred to using variable names. Defaults to NULL.

outcome

Vector of variable names to be treated as outcome (optional). This is a variable that can be predicted by others but cannot predict. If no header is used, then variables should be referred to with V followed (with no separation) by the column number. If a header is used, variables should be referred to using variable names.

conv_vars

Vector of variable names to be convolved via smoothed Finite Impulse Response (sFIR). Defaults to NULL.

conv_length

Expected response length in seconds. For functional MRI BOLD, 16 seconds (default) is typical for the hemodynamic response function.

conv_interval

Interval between data acquisition. Currently conv_length/conv_interval must be a constant. For fMRI studies, this is the repetition time. Defaults to 1.

mult_vars

Vector of variable names to be multiplied to explore bilinear/modulatory effects (optional). All multiplied variables will be treated as exogenous (X can predict Y but cannot be predicted by Y). Within the vector, multiplication of two variables should be indicated with an asterik (e.g. V1*V2). If no header is used, variables should be referred to with V followed by the column number (with no separation). If a header is used, each variable should be referred to using variable names. If multiplication with the lag 1 of a variable is desired, the variable name should be followed by "lag" with no separation (e.g. V1*V2lag). Note that if multiplied variables are desired, at least one variable in the dataset must be specified as exogenous. Defaults to NULL.

mean_center_mult

Logical. If TRUE, the variables indicated in mult_vars will be mean-centered before being multiplied together. Defaults to FALSE.

standardize

Logical. If TRUE, all variables will be standardized to have a mean of zero and a standard deviation of one. Defaults to FALSE.

hybrid

Logical. If TRUE, enables hybrid-VAR models where both directed contemporaneous paths and contemporaneous covariances among residuals are candidate relations in the search space. Defaults to FALSE.

VAR

Logical. If true, VAR models where contemporaneous covariances among residuals are candidate relations in the search space. Defaults to FALSE.

Author

Stephanie Lane

Details

Output is a list of results if saved as an object and/or files printed to a directory if the "out" argument is used.

Examples

Run this code
 if (FALSE) {
fit <- indSEM(data   = "C:/data100",
              out    = "C:/data100_indSEM_out",
              sep    = ",",
              header = FALSE)
print(fit, file = "group1.1", estimates = TRUE)
plot(fit, file = "group1.1")
 }

Run the code above in your browser using DataLab