This is the repository for the materials of the Data Analysis class at the UPF Masters for Brain & Cognition taught by Klaus Wimmer & Alex Hyafil, largely using material from Albert Compte.
Why should a cognitive psychologist / neuroscientist learn how to code? See the arguments in these different sources:
- "The next generation of neuroscientists needs to learn how to code" article from Neuron journal
- "Why it's important to learn to code in contemporary biology?" article from Wire
- "Why every (psychology) student should learn to code" blog post
You can brush up your Python skills by following one (or some) of these suggested Python tutorials:
- Introduction to Python from the Department of Cognitive Science of UC San Diego
- Python for Everybody Specialization (free Coursera course starts Dec 20)
- LearnPython.org
- Datacamp - Intro to Python for Data Science
- Python training at the Neuromatch Academy: Day 1 and Day 2, tutorials with videos
- Introductory material from the "Advanced Scientific Programming in Python" summer school
- If your master's project relies heavily on programming or you continue along with a PhD, we strongly recommend reading quietly through Patrick Mineault's wonderful Good Research Code Handbook
In this class we will run our analyses by coding them in Python. We will do this both in class and at home, so we need to have proper access to these programs. There are three different options: in the first one code will be run locally on your computer, while the second and third option use cloud computing (so no installation of any software on your computer):
- If you will be using your own laptop at all times, you may want to install Python locally. The best option is to install the Anaconda package, which comes with everything we need for the class.
- The preferred option for running Python codes in the cloud is using Google Colab, which is a free service. Just click on the "Google Colab" icon next to an assignment to open it in Google Colab (you can also go to the Google Colab homepage and import a notebook from your computer or with an url.
- Alternatively, you can run Python codes in the cloud using Anaconda in myapps.upf.edu. This might be faster than on a slow local computer as it runs on UPF servers. You get a detailed explanation of this service here. When you access MyApps you will be able to upload and download files from your MyCloudFiles folder. Then, when you open a Jupyter Notebook from within a session of Anaconda in MyApps you will be working on that MyCloudFiles folder, so you can work and keep your code organized there. You will have everything in the cloud and accessible from any computer anywhere.
You can also refresh your statistics with the following online courses:
- Intro to statistics
- Intro to inferential statistics
- Intro to descriptive statistics
- Statistics tutorial at the Neuromatch Academy, tutorials with videos
- First steps: Notebook
- Second steps (optional!):Notebook
- Slides from the first class
In this assignment, we will see:
- how to visually inspect experimental data
- how to characterize experimental data using descriptive statistics
- how to perform a simple statistic test using either a parametric (T-test) or non-parametric (shuffling) method
- how to assess the impact of an experimental factor on our experimental measurement using linear regression
- how to take into account the hetereogeneity of our sample population using linear mixed models
The following resources will help you to get ready to complete this assignment.
- Watch this video (here the notes and slides) only until time stamp 23:08 (stop right after permutation tests) in order to learn about:
- the logic of t-tests to test the hypothesis that two samples have the same mean
- the non-parametric equivalent in permutation tests. Make sure you understand this logic
- Watch this video and then follow with this video to learn the concepts about simple linear regression
- For a complementary look on linear regression that put its into the more general framework of model fitting, watch this video (until 15:10) and then follow with this video (linear regression by minimizing squared errors) and this one (linear regression by maximizing likelihood). These are parts of the material for Model Fitting day which are accessible here.
- (Very optional) See these notes from Eero Simoncelli (NYU) if you want to delve more into the mathematics related to linear regression
- Read this paper (focussing on Experiment 2) to understand the logic of the experimental data that we will analyze