This repository contains code for the paper People construct simplified mental representations to plan by Ho, Abel, Correa, Littman, Cohen, and Griffiths.
It is organized into the following subdirectories:
experiment.psiturkapp
contains code for running the experiments using the psiturk framework (see here).experiments
includes data and code for generating experimental trialsanalyses
includes notebooks and scripts for analyses in the papervgc_project
is a python package thatanalyses
andmodeling
depend onmodeling
includes modeling code that is not directly related to the experiments
It is also linked to this OSF repository.
The project uses Python 3 (everything works with 3.7). One way to use it is by setting up a virtualenv:
$ virtualenv -p python3 env
$ source env/bin/activate
(env)$ env/bin/pip install -r requirements.txt
You need to also install the vgc_project
package
into the virtual environment
(the -e
flag installs it in editable mode):
(env)$ env/bin/pip install -e ./vgc_project
Once you have a python environment set up,
the projects.py
script can be used to run
various analysis scripts and notebooks for the experiments.
First, unzip all the datafiles:
$ python project.py unzip_files
Then, run the analysis notebooks (this could take awhile the first time but afterwards various computations will be cached):
$ python project.py run_analysis_notebooks
The analysis notebooks are all included in analyses/
.
You may have to set the PYTHONHASHSEED
variable
to 0 to replicate certain analyses. See
here.
Some of the hierarchical generalized linear regression analyses
are done using the lme4
package in R.
The vgc_project.r
module provides wrappers that
interface with R using the rpy2
package
(see here).
This requires installing R.
Note: I have found that rpy2 will not install on python 3.9 on OSX.
All the code for the value-guided construal model
and alternative models is organized in the vgc_project
package folder.
Several of the models rely on code from the msdm
(version 0.6)
python package, which is automatically installed via pip using
the instructions above.
You can run the code in experiment.psiturkapp
as a psiturk experiment by doing the following:
$ cd experiment.psiturkapp
$ make dev
This creates a server at http://localhost:22362. Specific experiments can be demoed at the following links once you have the server running:
- Initial experiment (Exp 1)
- Up-front planning experiment (Exp 2)
- Critical maze experiment with awareness probes (Exp 3)
- Critical maze experiment with recall probes (Exp 3)
- Process-tracing experiment with initial mazes (Exp 4a)
- Process-tracing experiment with critical mazes (Exp 4b)
- Perceptual control with initial mazes (Exp 5a)
- Perceptual control with critial mazes and awareness probes (Exp 5b)
- Perceptual control with critial mazes and recall probes (Exp 5b)
- Execution control with initial mazes (Exp 6a)
- Execution control with initial mazes and awareness probes (Exp 6b)
- Execution control with initial mazes and recall probes (Exp 6b)