Open Educational Resources

Document Type

Tutorial

Publication Date

Fall 9-16-2016

Abstract

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.

Comments

This is version 3. The R scripts that accompany this file are text files and can be read in any word processor or text editor in addition to being opened in R itself.

Creative Commons License

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 4.0 License.

Between Subjects Simulation Design.R (2 kB)
Between Subjects Simulation Design

Data Generation Function.R (1 kB)
Data Generation Function

Mixed Factorial Simulation Design.R (5 kB)
Mixed Factorial Simulation Design

Within Subjects Simulation Design.R (2 kB)
Within Subjects Simulation Design

Share

COinS
 
 

To view the content in your browser, please download Adobe Reader or, alternately,
you may Download the file to your hard drive.

NOTE: The latest versions of Adobe Reader do not support viewing PDF files within Firefox on Mac OS and if you are using a modern (Intel) Mac, there is no official plugin for viewing PDF files within the browser window.