1.3. Graphical and Numerical Summaries of Multivariate Data 17 (x - mean(x))^2 [1] 56.25 30.25 12.25 12.25 6.25 0.25 0.25 30.25 30.25 [10] 132.25 sum((x - mean(x))^2) [1] 310.5 n= length(x) 1/(n-1) * sum((x - mean(x))^2) [1] 34.5 var(x) [1] 34.5 sd(x) [1] 5.8737 sd(x)^2 [1] 34.5 1.3. Graphical and Numerical Summaries of Multivariate Data 1.3.1. Side-by-Side Comparisons Often it is useful to consider two or more variables together. In fact, we have already done some of this. For example, we looked at iris sepal length separated by species. This sort of side-by-side comparison in graphical or tabular form is especially useful when one variable is quantitative and the other categorical. Graphical or numerical summaries of the quantitative variable can be made separately for each group defined by the categorical variable (or by shingles of a second quantitative variable). See Appendix A for more examples. 1.3.2. Scatterplots There is another plot that is useful for looking at the relationship between two quantitative variables. A scatterplot (or scattergram) is essentially the familiar Cartesian coordinate plot you learned about in school. Since each observation in a bivariate data set has two values, we can plot points on a rectangular grid repre- senting both values simultaneously. The lattice function for making a scatterplot is xyplot(). The scatterplot in Figure 1.10 becomes even more informative if we separate the dots of the three species. Figure 1.11 shows two ways this can be done. The first uses a conditioning variable, as we have seen before, to make separate panels for each species. The second uses the groups argument to plot the data in the same panel but with different symbols for each species. Each of these clearly indicates that, in general, plants with wider sepals also have longer sepals but that the typical values of and the relationship between width and length differ by species. 1.3.3. Two-Way Tables and Mosaic Plots A 1981 paper [Rad81] investigating racial biases in the application of the death penalty reported on 326 cases in which the defendant was convicted of murder.
Previous Page Next Page