SweetPea: A standard language for factorial experimental design

Sebastian Musslick, Anastasia Cherkaev, Ben Draut, Ahsan Sajjad Butt, Pierce Darragh, Vivek Srikumar, Matthew Flatt, Jonathan D. Cohen

Research output: Contribution to journalArticlepeer-review


Experimental design is a key ingredient of reproducible empirical research. Yet, given the increasing complexity of experimental designs, researchers often struggle to implement ones that allow them to measure their variables of interest without confounds. SweetPea (https://sweetpea-org.github.io/) is an open-source declarative language in Python, in which researchers can describe their desired experiment as a set of factors and constraints. The language leverages advances in areas of computer science to sample experiment sequences in an unbiased way. In this article, we provide an overview of SweetPea’s capabilities, and demonstrate its application to the design of psychological experiments. Finally, we discuss current limitations of SweetPea, as well as potential applications to other domains of empirical research, such as neuroscience and machine learning.

Original languageEnglish (US)
Pages (from-to)805-829
Number of pages25
JournalBehavior Research Methods
Issue number2
StatePublished - Apr 2022

All Science Journal Classification (ASJC) codes

  • Experimental and Cognitive Psychology
  • General Psychology
  • Developmental and Educational Psychology
  • Arts and Humanities (miscellaneous)
  • Psychology (miscellaneous)


  • Factorial design
  • Nuisance factor
  • Randomization and sampling
  • Sequential constraints


Dive into the research topics of 'SweetPea: A standard language for factorial experimental design'. Together they form a unique fingerprint.

Cite this