data-sim-workshops

Data simulation workshop materials and associated R package

CC-BY-4.0 License

Stars
15

output: github_document

knitr::opts_chunk$set(
  collapse = TRUE,
  warning = FALSE,
  message = FALSE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
set.seed(8675309)

Data Simulation Workshop Materials {style="float:right; width:200px;"}

Being able to simulate data allows you to:

  • prep analysis scripts for pre-registration
  • calculate power and sensitivity for analyses that don't have empirical methods
  • create reproducible examples when your data are too big or confidential to share
  • enhance your understanding of statistical concepts
  • create demo data for teaching and tutorials

Installation

You can install the packages used in these tutorials and get a function that makes it easy to access the workshop .Rmd files by running the following code:

devtools::install_github("debruine/data-sim-workshops")

Then you can load exercises with the following code:

dsw::exercise("faux")
dsw::exercise("calories")
dsw::exercise("fixed")
dsw::exercise("mixed")

Alternatively, download the stub files and install the specific packages for your workshop.

Upcoming Workshops

When: 2024 February 1-2 Where: Data Simulation Workshop 2024, Institute of Psychology, Bern, Switzerland

Data Simulation with {faux}

This session will cover the basics of simulation using {faux}. We will simulate data with factorial designs by specifying the within and between-subjects factor structure, each cell mean and standard deviation, and correlations between cells where appropriate. This can be used to create simulated data sets to be used in preparing the analysis code for pre-registrations or registered reports. We will also create data sets for simulation-based power analyses. Students will need to have very basic knowledge of R and R Markdown, and have installed {faux}, {afex}, {broom} and {tidyverse}.

Prep

  • Install R packages from CRAN: tidyverse, afex, faux, and broom
  • Download files: faux-stub.Rmd

Data simulation for mixed designs

This session will cover simulating data for a mixed design, where trials are crossed with subjects. We will learn how to analyse this using {lme4}, with a focus on understanding how the simulation parameters correspond to the output. Finally, we will learn how to use simulation to calculate power. Students will need to have basic knowledge of R and R Markdown, some familiarity with mixed designs (even if they don't currently analyse them with mixed models) and have installed {faux}, {afex}, {tidyverse}, and {lme4}.

Prep

  • Install R packages from CRAN: tidyverse, afex, lme4, broom, broom.mixed, faux
  • Download files: mixed-stub.Rmd

Resources

Past Workshops

  • Vrije Universiteit Amsterdam, NL Fake It Until You Make It: How and why to simulate research data 2023 September 20

  • Max Planck Institute for Evolutionary Anthropology, Leipzig, Germany Simulating data with {faux} 2023 July 27 9:00 - 12:00 (CET)

  • European Evolutionary Biology Conference, Millport, Scotland Fake It Until You Make It: How and why to simulate research data 2023 June 1 14:30 - 16:30 (GMT)

  • University of Glasgow Institute of Neuroscience & Psychology Data Simulation with {faux} 2023 January 18 12:00 - 13:00 (GMT)

  • Netherlands Institute for the Study of Crime and Law Enforcement Data Simulation with {faux} 2022 December 6 13:00 - 14:00 (CET)

  • Polish Association of Social Psychology Conference, Gdánsk Data simulation for fixed effects Data simulation for mixed designs Practical Session 2022 September 14 09:00 - 16:00 (CET)

  • RLadies Glasgow Data simulation using faux 2022 May 24 15:00-17:00 (BST)

  • University of York Data simulation for factorial designs Data simulation for mixed designs 2022 April 27 09:00-17:00 (BST)

  • From Proposal to Publication: Pathways to Open Science Data simulation for factorial designs Data simulation for mixed designs 2022 July 13 13:30-17:00

  • University of Glasgow Institute of Neuroscience and Psychology 2020 Jan 28 13:00-15:00 and Feb 5 14:00-16:00

  • University of Grenoble Understanding Mixed-Effects Models through Data Simulation 2021 February 5 13:00-15:00

  • PsyPAG Data Simulation Summer School Simulation for factorial designs with faux 2021 June 4 13:00-15:00