Learn R Programming

gimme (version 0.1-2)

aggSEM: Group-level structural equation model search.

Description

Concatenates all individual-level data files and fits a group model to the data.

Usage

aggSEM(data   = "",
       sep    = "",
       header = ,
       out    = "",
       ar     = FALSE,
       plot   = TRUE,
       paths  = NULL)

Arguments

data
Path to the directory where the data files are located. Each file 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.
sep
The spacing of the data files. "" indicates space-delimited, "/t" indicates tab-delimited, "," indicates comma delimited.
header
Logical. Indicate TRUE for data files with a header.
out
The path to the directory where the results will be stored. This directory must be generated by the user prior to running the function.
ar
Logical. If TRUE, begins search for group model with autoregressive (AR) paths open. Defaults to FALSE.
plot
Logical. If TRUE, graphs depicting relations among variables of interest will automatically be created. For aggregate-level plot, red paths represent positive weights and blue paths represent negative weights. Defaults to TRUE.
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. If no header is used, then variables should be referred to with V followed (with no separation) by t

itemize

  • betas

item

  • SEs
  • plots

Details

In main output directory:
  • all.elements
{Contains information for all paths identified for the concatenated samplel.} all.fit {Contains model fit information for final aggregate-level model.}

Examples

Run this code
data(ts1,ts2,ts3,ts4,ts5)
input.path  <- file.path(tempdir(),"input")
output.path <- file.path(tempdir(),"output")
dir.create(input.path)
dir.create(output.path)
write.table(ts1,file.path(input.path,"ts1.txt"),col.names=FALSE,row.names=FALSE)
write.table(ts2,file.path(input.path,"ts2.txt"),col.names=FALSE,row.names=FALSE)
write.table(ts3,file.path(input.path,"ts3.txt"),col.names=FALSE,row.names=FALSE)
write.table(ts4,file.path(input.path,"ts4.txt"),col.names=FALSE,row.names=FALSE)
write.table(ts5,file.path(input.path,"ts5.txt"),col.names=FALSE,row.names=FALSE)
aggSEM(data   = input.path,
       sep    = "",
       header = FALSE,
       out    = output.path,
       ar     = TRUE,
       plot   = TRUE,
       paths  = NULL)

Run the code above in your browser using DataLab