By Dr Poppy Watson
When people think of computer programming (coding) they might picture a group of hackers trying to steal bank details or people making video games and coding YouTube algorithms. However, coding is an important tool across many industries and it is becoming more and more integral to scientific research. Although it might seem that coding is only for extremely clever mathematicians living in their mother’s basement, it really is not that difficult to learn. It’s also really fun! Tweaking code and puzzling out the errors is a very satisfying part of my job as a researcher.
The scientific field that you are in will determine which programmes are used and the ‘languages’ that are used to code. Although the languages might be quite different in the commands that are used, most of the coding concepts are similar. In the field of Psychology we tend to run complex experimental paradigms – presenting sounds or images and recording responses. These often interface with external software such as eye trackers and neuroimaging (MRI or EEG) equipment. These in turn generate huge amounts of data which needs to be reduced to a manageable level for statistical analysis. Depending on what you need your computer to do will determine which software package you will code in. In Psychology for example some of the most common are Matlab, R, Inquisit, Python, Presentation and jsPsyc. These all have their pros and cons and many have a community of users who are passionate about their favourite programmes. I went on a hunt around the UNSW Psychology department to find out who else enjoys programming and what software packages are being used.
Jess is a postdoctoral researcher who looks at how people generalise what they learnt in one situation (e.g., the dog bit me) to novel situations (e.g., do all dogs bite)? Overgeneralisation to too many novel situations is thought to be a problem in anxiety disorders. Jess runs lots of online experiments and uses the jsPsych library for running experiments in the browser. She also uses Matlab for programming lab-based experiments and R for analysis of data, making figures and computational modelling. Computational modelling is frequently used in psychology and behavioural neuroscience. It involves building a statistical model that best describes participants’ behaviour over the experiment (e.g., response behaviour, eye-gaze movements or brain responses or a combination of these). It gives a much more nuanced view of what individuals are doing, rather than just taking the mean across all trials in an experiment. Another advantage is that it allows you to concretely specify and test a theory and generate novel predictions that you might not have thought of otherwise. A self-professed lover of R, Jess recently gave a talk at the launch of the R-ladies Sydney chapter. R-ladies is a global community committed to promoting R and encouraging gender diversity in the programming world. They organise seminars, online tutorials and meet-ups for people who just want to code (and get support in their coding). Jess loves R because it helps her to be more efficient: “It’s great for making pretty figures and already being a user of R means that I had the confidence to pursue computational modelling”.
Justine is a postdoctoral researcher who works in the behavioural neuroscience labs. She studies specific brain regions and how they contribute to behaviour. She uses Matlab to control apparatus in the lab (e.g. the presentation of lights and tones) and to analyse behavioural and neural data. Huge amounts of data are collected when investigating brain activity and Matlab is needed to filter it down (think huge excel files being made more manageable by collapsing the data across various columns and rows). Justine learnt during her 4th (honours) undergraduate year at UNSW how to code in Matlab – simply by trouble shooting, reading other people’s code and extensive reading of the help sections. “After a while you realise that running your script will not result in anything bad happening just a few error messages!” I think that Justine’s experience is common– not many people are crazy coding geniuses – instead, researchers learn on the job and modify existing scripts – continually learning and improving them.
Follow Poppy on Twitter (@Pop_Watson)