In today's pattern recognition class my professor talked about PCA, eigenvectors & eigenvalues.

I got the mathematics of it. If I'm asked to find eigenvalues etc. I'll do it correctly like a machine. But I didn't understand it. I didn't get the purpose of it. I didn't get the feel of it. I strongly believe in

you do not really understand something unless you can explain it to your grandmother -- Albert Einstein

Well, I can't explain these concepts to a layman or grandma.

  1. Why PCA, eigenvectors & eigenvalues? What was the need for these concepts?
  2. How would you explain these to a layman?
link|improve this question
9  
Good question. I agree with the quote as well. I believe there are many people in statistics and mathematics who are highly intelligent, and can get very deep into their work, but don't deeply understand what they are working on. Or they do, but are incapable of explaining it to others.I go out of my way to provide answers here in plain English, and ask questions demanding plan English answers. – Neil McGuigan Sep 15 '10 at 21:43
1  
This was asked on the Mathematics site in July, but not as well and it didn't get many answers (not surprising, given the different focus there). math.stackexchange.com/questions/1146/… – whuber Sep 16 '10 at 5:03
feedback

15 Answers

This manuscript really helped me grok PCA. I think it's still too complex for explaining to your grandmother, but it's not bad. You should skip first few bits on calculating eigens, etc. Jump down to the example in chapter 3 and look at the graphs.

I have some examples where I worked through some toy examples so I could understand PCA vs. OLS linear regression. I'll try to dig those up and post them as well.

edit: You didn't really ask about the difference between Ordinary Least Squares (OLS) and PCA but since I dug up my notes I did a blog post about it. The very short version is OLS of y ~ x minimizes error perpendicular to the independent axis like this (yellow lines are examples of two errors):

alt text

If you were to regress x ~ y (as opposed to y ~ x in the first example) it would minimize error like this:

alt text

and PCA effectively minimizes error orthogonal to the model itself, like so:

alt text

More importantly, as others have said, in a situation where you have a WHOLE BUNCH of independent variables, PCA helps you figure out which ones matter the most. The examples above just help visualize what the first principal component looks like in a really simple case.

In my blog post I have the R code for creating the above graphs and for calculating the first principal component. It might be worth playing with to build your intuition around PCA. I tend to now really own something until I write code that reproduces it.

link|improve this answer
1  
+1 for really caring to answer. – claws Sep 16 '10 at 18:55
1  
The tutorial was really great. Could you suggest any further tutorials as a follow-up? – Edward Sep 21 '10 at 9:54
1  
Good call on the Lindsay I Smith manuscript - just read it today; very helpful. – Stedy Oct 23 '10 at 5:58
So is PCA equivalent to Total Least Squares if it optimizes orthogonal distances from points to the fit line? – Marcin Apr 16 '11 at 14:25
@Marcin - this is correct. You can re-phrase PCA as finding the best rank $m$ estimate ($1\leq m\leq p$) of the original $p$ variables ($\hat{x}_{ij}\;\;\;\; i=1,\dots,n\;\;\;j=1,\dots,p$), with an objective function of $\sum_{i=1}^{n}\sum_{j=1}^{p}(x_{ij}-\hat{x}_{ij})^{2}$. Choosing the number of PCs is equivalent to choosing the rank of the predictions. – probabilityislogic Sep 5 '11 at 7:24
feedback

Hmm, here goes for a completely non-mathematical take on PCA...

Imagine you have just opened a cider shop. You have 50 varieties of cider and you want to work out how to allocate them onto shelves, so that similar-tasting ciders are put on the same shelf. There are lots of different tastes and textures in cider - sweetness, tartness, bitterness, yeastiness, fruitiness, clarity, fizziness etc etc. So what you need to do to put the bottles into categories is answer two questions:

1) What qualities are most important for identifying groups of ciders? e.g. does classifying based on sweetness make it easier to cluster your ciders into similar-tasting groups than classifying based on fruitiness?

2) Can we reduce our list of variables by combining some of them? e.g. is there actually a variable that is some combination of "yeastiness and clarity and fizziness" and which makes a really good scale for classifying varieties?

This is essentially what PCA does. Principal components are variables that usefully explain variation in a data set - in this case, that usefully differentiate between groups. Each principal component is one of your original explanatory variables, or a combination of some of your original explanatory variables.

link|improve this answer
What about the eigenvectors & eigenvalues? – Ηλίας Oct 14 '10 at 8:29
Okay: the Eigenvalue associated with each principal component tells you how much variation in the data set it explains (in my example, how clearly it separates your bottles into groups). They are usually expressed as a percentage of the total variation in the data set. As for the Eigenvectors, well, that's where as claws said I follow the output of an analysis like a machine ;) In my head, they are related to how you rotate Vince's mobile to its 'best' orientation, but this might not be the right way to think of them. – Freya Harrison Oct 27 '10 at 13:07
1  
Eigenvectors are just the linear combinations of the original variables (in the simple or rotated factor space); they described how variables "contribute" to each factor axis. Basically, think of PCA as as way to construct new axes that point to the directions of maximal variance (in the original variable space), as expressed by the eigenvalue, and how variables contributions are weighted or linearly transformed in this new space. – chl Nov 23 '10 at 21:46
feedback

Let's do (2) first. PCA fits an ellipsoid to the data. An ellipsoid is a multidimensional generalization of distorted spherical shapes like eggs, cigars, and pancakes. These are all neatly described by the directions and lengths of their principal (semi-)axes, such as the axis of the cigar or egg or the plane of the pancake. No matter how the ellipsoid is turned, the eigenvectors point in those principal directions and the eigenvalues give you the lengths. The smallest eigenvalues correspond to the thinnest directions having the least variation, so ignoring them (which collapses them flat) loses relatively little information: that's PCA.

(1) Apart from simplification (above), we have needs for pithy description, visualization, and insight. Being able to reduce dimensions is a good thing: it makes it easier to describe the data and, if we're lucky to reduce them to three or less, lets us draw a picture. Sometimes we can even find useful ways to interpret the combinations of data represented by the coordinates in the picture, which can afford insight into the joint behavior of the variables.

link|improve this answer
To add to this, when you have (near-)equal semiaxes (i.e. the ellipsoid has a (near-)circular slice), it indicates that the two pieces of data corresponding to those axes have (near-)dependency; one can talk about principal axes for an ellipse, but circles only have one radius. :) – J. M. Sep 16 '10 at 9:43
1  
I would be more cautious here, J.M. First, just to clarify, by "near-dependency" you must mean "nearly independent." This would be true for a multinormal variate, but in many cases PCA is performed with data that are markedly non-normal. Indeed, the clustering analyses that follow some PCA calculations can be viewed as one way to assess a strong form of non-normality. Mathematically, circles do have principal axes, but they are just not uniquely determined: you can choose any orthogonal pair of radii as their principal axes. – whuber Sep 16 '10 at 14:11
Yes, sorry, I suppose "the principal axes of a circle are indeterminate" would have been a better way of putting it. – J. M. Sep 16 '10 at 16:13
1  
+1 for the geometric explanation. – vqv Dec 20 '10 at 4:49
feedback

Alright, I'll give this a try. A few months back I dug through a good amount of literature to find an intuitive explanation I could explain to a non-statistician. I found the derivations that use Lagrange multipliers the most intuitive.

Let's say we have high dimension data - say 30 measurements made on an insect. The bugs have different genotypes and slightly different physical features in some of these dimensions, but with such high dimension data it's hard to tell which insects belong to which group.

PCA is a technique to reduce dimension by:

  1. Taking linear combinations of the original variables.
  2. Each linear combination explains the most variance in the data it can.
  3. Each linear combination is uncorrelated with the others

Or, in mathematical terms:

  1. For Y_j = a_j' x (linear combination for jth component)
  2. For k > j, V(Y_k) < V(Y_j) (first components explain more variation)
  3. a_k' a_j = 0 (orthogonality)

Finding linear combinations that satisfy these constraints leads us to eigenvalues. Why?

I recommend checking out the book An Introduction to Multivariate Data Analysis for the full derivation (p. 50), but the basic idea is successive optimizations problems (maximizing variance) constrained such that a'a = 1 for coefficients a (to prevent the case when variance could be infinite) and constrained to make sure the coefficients are orthogonal.

This leads to optimization with Lagrange multipliers, which in turn reveals why eigenvalues are used. I am too lazy to type it out (sorry!) but, this PDF goes through the proof pretty well from this point.

I would never try to explain this to my grandmother, but if I had to talk generally about dimension reduction techniques, I'd point to this trivial projection example (not PCA). Suppose you have a Calder mobile that is very complex. Some points in 3-d space close to each other, others aren't. If we hung this mobile from the ceiling and shined light on it from one angle, we get a projection onto a lower dimension plane (a 2-d wall). Now, if this mobile is mainly wide in one direction, but skinny in the other direction, we can rotate it to get projections that differ in usefulness. Intuitively, a skinny shape in one dimension projected on a wall is less useful - all the shadows overlap and don't give us much information. However, if we rotate it so the light shines on the wide side, we get a better picture of the reduced dimension data - points are more spread out. This is often what we want. I think my grandmother could understand that :-)

link|improve this answer
3  
That's very layman ;-) – mbq Sep 15 '10 at 21:24
It's a little mathy, but the best way to understand something is to derive it. – Vince Sep 16 '10 at 1:08
5  
You have an exceptionally well-educated grandmother :-). – whuber Sep 16 '10 at 1:44
1  
i like the explanation with the light shining on a 3-d structure – Neil McGuigan Jun 7 '11 at 18:40
feedback

OK, a totally non-math answer:

If you have a bunch of variables on a bunch of subjects and you want to reduce it to a smaller number of variables on those same subjects, while losing as little information as possible, then PCA is one tool to do this.

It differs from factor analysis, although they often give similar results, in that FA tries to recover a small number of latent variables from a larger number of observed variables that are believed to be related to the latent variables.

link|improve this answer
Hey Peter! Good to see you here. This is a really good, simple, no math answer. – JD Long Sep 16 '10 at 19:40
1  
+1 for mentioning FA, which no one else seems to discuss, and which some people's explanations seem to blend towards. – gung Jan 31 at 3:52
feedback

From someone who has used PCA a lot (and tried to explain it to a few people as well) here's an example from my own field of neuroscience.

When we're recording from a person's scalp we do it with 64 electrodes. So, in effect we have 64 numbers in a list that represent the voltage given off by the scalp. Now since we record with microsecond precision, if we have a 1-hour experiment (often they are 4 hours) then that gives us 10e6 * 60^3 == 216,000,000,000 time points at which a voltage was recorded at each electrode so that now we have a 216,000,000,000 x 64 matrix. Since a major assumption of PCA is that your variables are correlated, it is a great technique to reduce this ridiculous amount of data to an amount that is tractable. As has been said numerous times already, the eigenvalues represent the amount of variance explained by the variables (columns). In this case an eigenvalue represents the variance in the voltage at a particular point in time contributed by a particular electrode. So now we can say, "Oh, well electrode x at time point y is what we should focus on for further analysis because that is where the most change is happening". Hope this helps. Loving those regression plots!

link|improve this answer
feedback

Eigens are mathematical concept used for implementing PCA, so they are out of discussion. PCA is based on the idea that the multivariate data is so hard to interpret not because the reality is complex, but because we have measured wrong variables, and the reality is trivial; namely there are only linear relations involved.
To this end we use some math-magick to expose this structure, and voilà.

This is pure wishful thinking, but it often works because of the Taylor expansion.

link|improve this answer
feedback

I view PCA as a geometric tool. If you are given a bunch of points in 3-space which are pretty much all on a straight line, and you want to figure out the equation of that line, you get it via PCA (take the first component). If you have a bunch of points in 3-space which are mostly planar, and want to discover the equation of that plane, do it via PCA (take the least significant component vector and that should be normal to the plane).

link|improve this answer
feedback

I'd answer in "layman's terms" by saying that PCA aims to fit straight lines to the data points (everyone knows what a straight line is). We call these straight lines "principal components". There are as many principal components as there are variables. The first principal component is the best straight line you can fit to the data. The second principal component is the best straight line you can fit to the errors from the first principal component. The third principal component is the best straight line you can fit to the errors from the first and second principal components, etc., etc.

If someone asks what you mean by "best" or "errors", then this tells you they are not a "layman", so can go into a bit more technical details such as perpendicular errors, don't know where the error is in x- or y- direction, more than 2 or 3 dimensions, etc. Further if you avoid making reference to OLS regression (which the "layman" probably won't understand either) the explanation is easier.

The eigenvectors and eigenvalues are not needed concepts per se, rather they happened to be mathematical concepts that already existed. When you solve the mathematical problem of PCA, it ends up being equivalent to finding the eigenvalues and eigenvectors of the covariance matrix.

link|improve this answer
+1, this is truly in "layman's terms", and I know you could derive it very rigorously if you wanted to! – gung Jan 31 at 3:53
feedback

I might be a bad person to answer this because I'm the proverbial grandmother who has had the concept explained to me and not much more, but here goes:

Suppose you have a population. A large portion of the population is dropping dead of heart attacks. You are trying to figure out what causes the heart attacks.

You have two pieces of data: height and weight.

Now, it's clear that there's SOME relationship between weight and heart attacks, but the correlation isn't really strong. There are some heavy people who have a lot of heart attacks, but some don't.

Now, you do a PCA, and it tells you that weight divided by height ('body mass') is a much more likely predictor of heart attacks then either weight or height, because, lo and behold, the "reality" is that it's body mass that causes the heart attacks.

Essentially, you do PCA because you are measuring a bunch of things and you don't really know if those are really the principle components or if there's some deeper underlying component that you didn't measure.

[Please feel free to edit this if it's completely off base. I really don't understand the concept any more deeply than this].

link|improve this answer
1  
Welcome to the stats site @Joel! If you get a chance, you might also contribute to the discussion on our proposed distributed StackExchange data analysis project: stats.stackexchange.com/questions/2512/…. – Shane Sep 16 '10 at 2:11
feedback

I had imagined a lengthy demo with a bunch of graphs and explanations when I stumbled across this.

link|improve this answer
1  
Similar to explanation by Zuur et al in Analyzing ecological data where they talk about projecting your hand on an overhead projector. You keep rotating your hand so that the projection on the wall looks pretty similar to what you think a hand should look like. – Roman Luštrik Sep 16 '10 at 9:00
feedback

Basically PCA finds new variables which are linear combinations of the original variables such that in the new space, the data has fewer dimensions. Think of a data set consisting of the points in 3 dimensions on the surface of a flat plate held up at an angle. In the original x, y, z axes you need 3 dimensions to represent the data, but with the right linear transformation, you only need 2.

Basically what @Joel said, but only linear combinations of the input variables.

link|improve this answer
feedback

Here is the link to "Analysing ecological data" by Alain F. Zuur, Elena N. Ieno, Graham M. Smith, where the example with the overhead-projector and the hand is given:

http://books.google.de/books?id=mmPvf-l7xFEC&lpg=PA15&ots=b_5iizOr3p&dq=Zuur%20et%20al%20in%20Analyzing%20ecological%20data&hl=en&pg=PA194#v=onepage&q&f=false

link|improve this answer
feedback

A two pages article explaining PCA for biologists:

Ringnér. What is principal component analysis?. Nature Biotechnology 26, 303-304 (2008)

link|improve this answer
feedback

Why so eigenvalues/eigenvectors ?

When doing PCA, you want to compute some orthogonal basis by maximizing the projected variance on each basis vector.

Having computed previous basis vectors, you want the next one to be:

  • orthogonal to the previous
  • norm 1
  • maximizing projected variance, i.e with maximal covariance norm

This is a constrained optimization problem, and the Lagrange multipliers (here's for the geometric intuition, see wikipedia page) tell you that the gradients of the objective (projected variance) and the constraint (unit norm) should be "parallel" at the optimium.

This is the same as saying that the next basis vector should be an eigenvector of the covariance matrix. The best choice at each step is to pick the one with the largest eigenvalue among the remaining ones.

link|improve this answer
Definitely not an explanation to a layman - orthogonal basis vectors? maximising projection variance? constrained optimisation problem? Lagrange multiplier? These are highly "jargonised" terms. Show a layman who understands what these mean and i'll show you a mathematician/statistician – probabilityislogic Sep 4 '11 at 22:55
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.