A measure of variability is perhaps the most important quantity in statistical analysis. The greater the variability in the data, the greater will be our uncertainty in the values of parameters estimated from the data, and the lower will be our ability to distinguish between competing hypotheses about the data.
Consider the following data, y, which are plotted simply in the order in which they were measured:
y <- c(13,7,5,12,9,15,6,11,9,7,12)
How can we quantify the variation (the scatter) in y that we can see here? Perhaps the simplest measure is the range of y values:
 5 15
This is a reasonable measure of variability, but it is too dependent on outlying values for most purposes. Also, we want all of our data to contribute to the measure of variability, not just the maximum and minimum values.
How about estimating the mean value, and looking at the departures from the mean (known as ‘residuals’ or ‘deviations’)?
for (i in 1:11) lines(c(i,i),c(mean(y),y[i]),col="red")
The longer the ...