Thursday, February 23, 2012

Procrustes analysis

In Greek mythology, Procrustes was a son of Poseidon with a sadistic streak. He would welcome weary travelers into his home, and after filling them with good food and cheer would invite them to sleep in his special bed. Unfortunately, if his guests didn't fit the bed exactly (and they never did!) Procrustes, in an anal retentive fury, would find a way to make them fit, either by cutting off a bit of their legs or flattening them out with a hammer. Procrustes was eventually done in by Theseus, who gave him a taste of his own medicine (see vase above).

As with many other mythological characters, Procrustes' name was adopted by nerds to denote a nerdy but essentially simple concept: if you want to analyze the shape of two similar objects, you need to first scale, rotate and translate the objects so that they are as perfectly superimposed as possible. Except instead of using hammers or axes, a few equations are used.

Now say you want to compare the shapes of a whole set of skulls, and see how they vary (based on landmarks that you define). You can compute the average shape of the lot, called the consensus, and see how the landmarks of all the other skull landmarks compare. The differences between each homologous landmark and the consensus are called Procrustes residuals. These are the starting point of the statistical analysis.

But it is useless to do a classic statistical treatment comparing all of your landmark variables. It's hard enough finding two-dimensional relationships. Imagine trying to compare the 25 (x,y,z) landmark coordinates of 100 skulls. And how will you represent the data? The answer is to use a Principal Component (PC) Analysis. This reduces your Procrustes residuals into more manageable chunks of data by finding which ensemble of landmark changes explain the largest part of the variation. Berge and Penin (2004) explain it better:

1) After superimposition, all landmarks are interdependent (they are all used for fitting). Therefore, an isolated landmark movement is hardly interpretable. Because PCs are a composite variable, shape changes are analyzed in PCs as a movement of a set of landmarks.

2) Procrustes residuals are too numerous to be used directly in statistical tests. In other words, too many variables create an excess of degrees of freedom and a decrease in the power of statistical tests. PCs are a means to reduce the number of variables by selecting those which have the greatest eigenvalues. The selection of PCs also allows us to eliminate nuisance parameters generated by superimposition (citations removed).

Thursday, February 16, 2012

Morpho J

Using my landmark data I made a simple wireframe in Morpho J, and applied a Principal Component Analysis (PCA). The idea is to reduce a lot of data into a smaller number of variables and identify which of these "components" explain most of the variation. I read that it's similar to image compression, and indeed similar math is used to create say a .JPG from a raw image file.

Principal Compontent 1 is by definition the component that is most variable, and in my case represents almost 80% of variation. As you can see, all the Homos are on the plus side and the Pongos and Pans are grouped on the negative side of the mean. Homo is closer to 0 because there were many more Homos in the sample. PC1 clearly delimits Homo from Pan and Pongo, and even shows a difference between Pongo and Pan.

PC2 on the other hand, does not distinguish Pan and Pongo from Homo, but shows a difference between Chimps and Ourangs.

Great, but what the hell are these "components" really? They show you there's a difference and quantify it, but they don't tell you what it is! That's where playing with the wireframe comes in handy.

The light blue wireframe represents the "consensus" individual - the mean. As you play with the PC1 weight, you can see how the dark blue shape changes from one extreme to the other. Here I slid it over to between the Pan and Pongo clusters.

You can also play with the PC2 weight. Notice how it makes much less of a difference.

I'm still feel pretty in the dark as to how the Principal Components are actually calculated, and thus what they really mean. I'll keep you posted when I learn more about eigenvalues.


Wrote a log shape ratio script.


Everyone hates me because I lobbied for including the vertex in the analysis. Ugh, now we have to put the skulls in the Frankfort Horizontal they whined! Well, we couldn't rightly go from the glabella to the inion could we?! Bunch of flatheads.

Thursday, February 2, 2012

A word about stereotypes

Some ignorant Americans think that French people are arrogant assholes, and that really pisses me off. I have spent considerable time in France for the last five years of my life, struggling to learn French and talking to real French people. I spent years trying to grasp the subtleties of this great and ancient culture, studying its literature, art, and rightfully celebrated art of living. I travelled throughout France, taking in her beautiful and extremely varied countryside, visiting innumerable historic sites and museums, and enjoying distinct regional cultures. I visited vineyards and wine makers, learned about the process of wine making, and my palate grew accustomed to some very good (and reasonably priced) vin! I also performed various jobs, working with students, farmers, professors, delivery people and office workers. The point is that I have intimate knowledge of what French people are really like, both rich and poor, old and young, country folk and city-dwellers alike. After all this experience, I must say that most French people are the most arrogant assholes you can imagine.

Do you see how infuriating this is? It's like if a physicist spent the last 5 years of his life trying to figure out how gravity works, and some fat Texan pulled up next to him in his Range Rover and said, "Duh, it makes shit fall down you fag! Haw haw!" The Texan then would then start guzzling a Big Gulp and leave the physicist in a cloud of dust and exhaust. Fuck you, ignorant Americans! You can't even begin to fathom the complexities of French assholery.

Whoa, whoa, whoa, Andrew! What crawled up your bidet? OK, I admit that this outburst is prompted by a series of hilariously assoholic incidents which I will permit myself to relate to you. The first two are train related.

Yesterday the train going back to Aix was particularly packed due to a strike that reduced the number of trains in service. As I boarded I saw that many people had already resigned themselves to just standing, but I went looking for a seat anyhow. I found one, but the girl opposite the seat said that somebody was sitting there. No matter, I found another seat not much farther down the car. Nobody took it because somebody had put their coat on it. When I inquired about whose seat it was, nobody said they knew, so I sat down. Then the man sitting behind me asked me, testily, to move so he could remove his coat. I laughed it off! As I settled in I noticed that I had a clear view of the seat I was originally going to take, and that it was still empty. I didn't think much of it - the train hadn't left yet, no worries. You see where this is going. It was right out of Curb Your Enthusiasm. Imagine my increasingly sour expression cross cut with shots of the empty seat as the train leaves, with the girl and her friends giggling. The seat was empty the entire trip! But to my shame I didn't instigate a LD-like confrontation with the girl.

Then, this morning I got on a similarly crowded train to go to Marseille. This was the express train, meaning there there are only two stops - first Gardanne then Marseille - and takes about 30 minutes. Shortly after leaving Gardanne, a smartly dressed train employee briskly walked past me, opened the door to the next compartment and said "I'd like to remind you that this section is First Class only. If you don't have a First Class ticket, please find another seat." So everybody obediently left (even though nobody else was there), except there are no other seats so they just stood for 20 minutes. Now, there are First Class sections on many trains, but I have never seen anyone give a shit about it, especially on a short commuter train. No wonder these people get stabbed. I don't get it. They go on strike, they don't bother to tell you why, act like douchebags and expect us to show solidarity? Or maybe it's just that the non-striking train workers are fascists.

Finally this afternoon I had some time to kill at the Marseille station (my train had been cancelled) so I went into a press shop. I checked out a few magazines, then, I admit, I spent a bit more time with an issue of Fluide Glaciale - five minutes maximum - when the 20 year old clerk came up to me and said abusez pas... which can mean "don't abuse", but it's better translated as "don't exagerate". I just raised my eyebrows in a 'what are you talking about' kind of way. Then a minute later he said something to the effect of "This is not a lending library!" to which of course I responded "I'm sorry I don't speak French. I only speak English!" (In English of course.) Ah, the glee in my heart when all he could do was open his mouth, then close it, with a mixture of anger and embarrassment flushing his face. After reading for a few more minutes I got in line to pay. When it was my turn I said "I was going to buy this, but I changed my mind because you're an asshole." (In French of course.) There are 3 press shops and 2 bookstores in a 100 meter radius at Marseille St Charles, and I've never been fucked with in a single one before today. Good job, new generation of French assholes!