# Instructions
This project repository contains all the files related to the project "Uncertainty in learning, choice and visual fixation" by Hrvoje Stojić, Jacob L. Orquin, Peter Dayan, Raymond Dolan and Maarten Speekenbrink. Public version can be found at Open Science Framework, at the following [link](https://osf.io/539ps/).
Licence for using the code, data and other materials in this repository: see `license.txt` file.
## Corresponding author
If you have questions about the files in this repository or find some errors, please get in touch with Hrvoje Stojić the main author of the documentation. You can find my updated contact details at [ORCID profile](https://orcid.org/0000-0002-9699-9052).
## Organization of the files
Directories with **c** prefix contain code for running various types of analyses. There is a designated directory `cModeling` with the code related to fitting the models, directory `cFigs` with the code that produces figures, `cExp` with the code related to the experiment, etc.
Directories with **d** prefix contain data. `dRaw` contains raw data, while we use `dProcessed` directory to save data that has been processed in some way, to keep raw data strictly separated. We provided final modeling results file where final processed results are stored, `dProcessed\modelResults.RData`, but not the individual Stan fits as they take a lot of space. Directory `pManuscript` contains the article, together with the source LaTeX and Bibtex files.
Directories with **r** prefix contain various types of results: `rFigs` contains all the figures produced by code in `cFigs` while `rFigsOthers` contains figures not generated by code. `rTables` folder contains various text outputs from analysis scripts, such as mixed effects regressions raw behavioral measures, produced by scripts in `cAnalysis`.
Each directory contains additional README file if additional details are needed on using the files contained in it. In README files in **c** directories you can find detailed information about the software dependencies, in case you wish to execute the code, but see also the section below on this topic.
## Dependencies
The project was completed using Linux operating system and some tools rely on Unix environment. More specifically, I have used Ubuntu 16.04 Linux operating system. For example, `GNU make` that I mention below is a program that comes on most Linux distributions by default. Note that Mac OS is Unix based and it should have them as well, or they are easily installed. Hence, if you are attempting to use the files on a Windows system or follow the instructions, I cannot provide much guidance.
For modeling and producing figures we have relied on R and Stan, together with several R packages. If you wish to execute the code, you should first visit [R website](https://www.r-project.org/) and read in more details there how to install R on your computer (I recommend [RStudio](https://www.rstudio.com/) as a nice user interface for R). In README files in **c** directories you can find detailed information about the packages used to execute the code contained within the directory. Note that exact package versions are listed for which you should get the same results. If you will have newer/older versions installed, some code might not run at all.
Software for the experiment was programmed in Python, using [PsychoPy library](https://www.psychopy.org/). More information on installation and usage is available in `cExp/README.md`.
For compiling the manuscript, you will need a (full) LaTeX installation on your computer. For guidance on installing required libraries on your operating system, see for example this [wikibooks](https://en.wikibooks.org/wiki/LaTeX/Installation) entry.
Operating System on which the code was developed and tested:
```{bash}
Linux puccini 4.11.0-14-generic #20~16.04.1-Ubuntu SMP Wed Aug 9 09:06:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
```
## Usage
We rely on `GNU make` files to automatize certain things. For example, to produce all the figures required for the article, one can simply open terminal in `cFigs` folder and execute `make` command. I tried documenting how to use each folder, if it was necessary, with README files. Finally, there is a makefile at the top level, where this README file resides, that you can use to clean the behavioral data, perform the analyses, produce the figures and compile the article with a single `make` call. Whether this will succeed depends on your operating system and whether all dependencies are satisfied.
Note that analysis includes model fitting and handling relatively big eye-tracking files, which require larger computing power and potentially substantial amount of time to complete. Hence, if you wish to rerun the analyses, you are welcome to do so, but bear in mind the resources and the time they will need to complete.