
i
i
“K23166” — 2015/1/28 — 9:35 — page 61 — #87
i
i
i
i
i
i
5.7. EXAMPLES 61
To save space, we can just print a subset of the correlations.
> cormat[c(2, 3), 1]
mcs pcs
-0.682 -0.293
Figure 5.2 displays a scatterplot (8.3.1) of CESD and MCS, for the female subjects. The
plotting character (9.1.2) is the initial letter of the primary substance (alcohol, cocaine, or
heroin). A rug plot (9.1.8) is added to help demonstrate the marginal distributions.
> with(ds, plot(cesd[female==1], mcs[female==1], xlab="CESD", ylab="MCS",
type="n", bty="n"))
> with(ds, text(cesd[female==1&substance=="alcohol"],
mcs[female==1&substance=="alcohol"],"A"))
> with(ds, text(cesd[female==1&substance=="cocaine"], ...