10.07.2015 Views

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Using</strong> R <strong>for</strong> introductory statistics 42Figure 2.6 An example of a stripchart showing each value in a datasetStrip charts are created in R with the stripchart() function. The extra argumentmethod="stack” will create stacks when there are ties in the data. Otherwise, multiplevalues will show up as a single plot character.Figure 2.6 shows the data on heights of 4-year-olds contained in the data set kid.weights (<strong>Using</strong>R). The following commands produce the graphic:> attach(kid.weights)> x=height[48 stripchart(x,method="stack",xlab="x",pch=1,offset=1,cex=2)> detach(kid.weights) # tidy upA lot of extra arguments are needed to make these graphs look right. The argument xlab=adjusts the label on the x-axis, pch=1 uses a different plot character than the defaultsquare, cex= changes the size of the plot character, and of f set= pushes the points apart.In this book, we use a visually stripped-down version of this graphic (Figure 2.7)made with the DOTplot() function available in the <strong>Using</strong>R package.> DOTplot(x)Figure 2.7 Alternative to stripchart(),with fewer lines2.2.3 The center: mean, median, and modeViewing the distribution of a data set with a stem-and-leaf plot or a strip chart can beoverwhelming if there is too much data. It is also convenient to have concise, numericsummaries of a data set. Most of these summaries are familiar from everyday usage. Notonly will the numeric summaries simplify a description of the data—they also allow us to

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!