Extended Data Figure 1.Software and code used for moderated mediation analyses. The code to perform moderated mediation analyses was generated with R, version 3.3.1 (2016-06-21). Additional R-packages installed were lme4 (Bates et al., 2015) and mediation (Tingley et al., 2014). The code was run on a x64-based PC using a Microsoft Windows 10 Pro operating system. Preprocessing of data was performed using MATLAB (MathWorks) to exclude trials where stimulus modality (pain/touch) was not correctly identified, trials which yielded ratings of 0 and trials with reaction times higher or lower than 2 SDs from the individual mean. Information on input data format is provided in the code as well as via a model file. Download Extended Data F, ZIP file.