ROC graph shape Could you explain to me how the shape of a ROC curve is determined?
From the following illustration, it seems that for every time the actual class (C) is positive, it goes up and when it's negative, it goes to the right.
Why does it only seem to be based on the true class rather than the actual right or wrong classification of the object?  I assume it's to do with the mentioned score, but I don't know how this would be calculated and ranked.  Please explain.

Thank you.
 A: The ROC curve is useful to determine a good compromise for the cut of level of a classification problem. In a naive way of looking, you set the cut of level so you have the lowest classification error. In your example, you could set the cut of level of the score (the third column) at 0.5. If above, it is classified as P, if below, classified as N
But in real life it might be that a classifying a negative as positive has a far higher cost as the inverse. Take the example of the diagnosis of cancer, you don't really want to tell somebody he is ok, where he actually has cancer (false positive). The other error, telling him he has cancer where he actually doesn't, isn't that bad as the patient will probably just be retested.
The ROC curve teaches us that we have to make a compromise between false positive rate and true positive rate. If for example we would not allow a false positive rate higher than 1%, we have to live with live with a pretty high true negative rate.
In the graph, the false positive rate is on the x-axis, where the true positive rate is on the y-axis.
That is more or less how I remember it, but it can very well be that I switched the terms around, as I always have to puzzle it out again. Pretty sure the wikipedia page http://en.wikipedia.org/wiki/Receiver_operating_characteristic will tell you everything about it. 
Hope this helped as a first introduction.
A: In the table, the subjects have been sorted by their score. This score is intended to characterize the subjects as positive (high score in this example) or negative (low score here).
As the true positives are on the y-axis, each positive lets the graph go up, as you observed. As the false positives are on the x-axis, each negative (only those can be false positive) lets the graph go right. Now you see how the "disorder" in the ordered table (ordered by the score, but its absolute value is of no convern any more) shapes the curve: If PNPNPNP..., the estimated ROC curve would look like stairs. This is associated with the worst possible classification: Although you have sorted the subjects by their score, the N and P are still perfectly mixed. So the score doesn't give a clue about the true status. Flipping a coin is as bad.
In turn, PPPPP...NNNNN would be perfect classification: All P are above some certain score and all N are below this score, the perfect cutoff. The ROC curve is then the upper left border of the plot, reaching the point of 100% true positives and 0% false positives.
In reality, the ROC curve is somewhere between these extreme cases. There you have to trade false positives against false negatives, as already noted by Kasper ad Alexis. 
(Note by the way that choice of the cutoff due to estimated ROC curve is too optimistic concerning the probabilities of true classification. This is because we would choose a upper left vertex of the plot and this point is typically more to the upper left than the true unknown ROC curve would ever be.)
A: I will use your animated image to illustrate the calculation. So, the table from the right side contains 20 data instances. These instances are indexed by their rank when ordered by the value from the third column, called score. Now, what is that score? Let's suppose that we have two classes/labels, named $1$ and $0$. That score is a numerical value which resembles the probability that that instance to be of class $1$. Because ROC curves deals only with binary case (I know there are extensions, but it does not matter here), than the probability that the same instance to be classified as the label $0$ is $1-Score$. The second column tells us which class the specific instance actually is considered. 
Usually, if the scores resembles probabilities (as I considered, and if it is not the case, one can easily transform scores to range $[0,1]$ to look like probabilities), a classifier predict an instance as class $1$ if the score for class $1$ is greater than the score for class $0$. If the sum of the scores is $1$, as I supposed, than is easy to see that this condition is the same as: predict an instance to be of class $1$ if score of that instance is greater than $0.5$. The main idea is that it uses a threshold value to discriminate in order to predict.
Now that we clarified what that information is we develop the idea behind ROC curves. ROC curves tells us how the classifier would behave for all useful values of the threshold, not only for the arbitrary value $0.5$. 
It starts from the threshold value of $1$ and drops incrementally until $0$. But which are the useful values for the threshold? For the threshold value of $1$ would give $TPR=0$ since no value from Score column is greater than $1$, and similarly $FPR=0$. One can note also that the threshold value of $0.95$ gives the same amounts. More, all the values of the threshold between $1$ and $0.9$ give the same values. The conclusion is that the only useful values for the running threshold are the distinct values from score column. So the ROC curve points will be computed only for those distinct values of score. 
One step further is to consider the threshold value of $0.9$. The $TPR =0.1$ because from all the $P=10$ instances which are labels actually as positive, only $TP=1$ has the score greater than the threshold values and is predicted as positive. You can follow wikipedia page and compute the same value for $FPR$. 
After doing that, you will obtain the coordinates of a point which will be part of the ROC curve. Then you peek the next increasing value of the threshold from all the useful values and repeat the algorithm. Finally you will end up in the right corner where all the actual $1$ instances are predicted as $1$ (TPR=1) and all the actual instances $0$ will be also predicted as $1$ and (FPR=1), the final point and the end of the ROC curve.
