# Day 7: diagnostics using principal component analysis¶

4 / 10 / 2015

This class is for us to get an idea of the variation in the FMRI data, and to start working with images as matrices. We will do this using principal component analysis (PCA).

In the class we will cover what PCA is and how it works.

For this explanation we need some basic ideas from linear algebra, and in particular, the idea of projecting a vector onto another vector using the dot product. This background will also be useful to us later in thinking about regressors and statistical models.

So the “readings” for this week are some excellent Khan academy videos on linear algebra.

### Basic background on dot products¶

Optional but highly recommended:

### Key video on projecting vectors¶

The following video is the key homework for the class. The videos above are background for this video.

### If you are racing ahead¶

If you have extra time on your hands or you are confident you already know about matrices and projection and want something more advanced, this is introductory tutorial on principal component analysis. It does assume that you know about projecting vectors, which you will, after covering the Khan academy videos.

## Day¶

• Get data from image
• Run PCA;
• Fetch projection matrices, vectors and values;
• Reconstruct data using reduced number of components.
• Investigate and diagnose components;
• Investigate correlation of vectors with data.

## Exercises¶

The usual instructions:

• cd pna/pna2015
• git pull
• ipython notebook

There is a web page listing of the exercise files at https://github.com/practical-neuroimaging/pna2015/tree/master/day7