The purpose of this tutorial is to provide a very basic introduction to implementing three simple research designs using the simsem package in R. R is an open source statistical computing environment (R Core Team, 2015). For more information about R, see the R Project homepage (https://www.r-project.org/) and the Comprehensive R Archive Network (CRAN) web page (https://cran.r-project.org/). The lavaan package provides functions for fitting and evaluating structural equation models (Rosseel, 2012). For further information about the lavaan package including tutorials, see the lavaan Project web page (http://lavaan.ugent.be/). The simsem package (Pornprasertmanit, Miller & Schoemann, 2016) provides functions to facilitate structural equation modeling simulation studies and is compatible with both lavaan and openMx (Boker, et al., 2014). For more information about the simsem package, see the simsem web page (http://simsem.org/). This document assumes some familiarity with the basics of R and assumes familiarity with lavaan model specification. The simsem web page provides extensive examples for running specific simulation conditions. The goal of this document is to provide a basic guide to implementing simple research designs by combining multiple conditions into a larger design for comparative analysis. Sample code illustrates the complete process including simulation, basic data management strategies, and graphical display of results. The document will focus on lavaan model specification and estimation but the techniques generalize to openMx. For more information about openMx, see the openMx web page (http://openmx.psyc.virginia.edu/).
The first section considers a simple two-group between-subjects design. The second section considers a within subjects design with two conditions. The third section combines these into a 2×2 mixed factorial design. The final section discuses the use of functions in programming simulations. This document also assumes basic familiarity with factorial research designs and terms used to describe them. Four self-contained R scripts accompany this tutorial.
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 4.0 License.