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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Using</strong> R <strong>for</strong> introductory statistics 82> plot(max.temp[−1], diff(DJA), main="Max. temp versusdaily change")> detach(maydow)Figure 3.7 Maximum temperatureversus daily change in DJIAFigure 3.7 contains the plot of maximum daily temperature versus daily change in thevariable DJA calculated using the diff () function. We needed to drop the first day’stemperature, as we have no difference data <strong>for</strong> that day. This was done using negativeindexing, max. temp [−1] . The scatterplot shows no trend. If the temperature doesinfluence the stock market, more data would be needed to see exactly how.■ Example 3.4: Kids’ weights: the relationship between height and weightThe proportions of the human body have long been of interest to humankind. EvenJonathan Swift wrote in Gulliver’s Travels (1726),Then they measured my right Thumb, and desired no more; <strong>for</strong> by amathematical Computation, that twice round the Thumb is once round theWrist, and so on to the Neck and the Waist, and by the help of my oldShirt, which I displayed on the Ground be<strong>for</strong>e them <strong>for</strong> a Pattern, theyfitted me exactly.Just as it seems intuitive that the bigger you are the bigger your thumb, it seems clear thatthe taller you are the heavier you are. What is the relationship between height andweight? Is it linear? Nonlinear? The body mass index (BMI) is a ratio of weight to heightsquared in the units of kilograms/meters 2 . This well-used statistic suggests height andweight are in a squared relationship.The data set kid. weights (<strong>Using</strong>R) contains height and weight data <strong>for</strong> children ages ato 12 years. A plot of height versus weight is found with the following. (Thepch=argument <strong>for</strong>ces the plot character to be “M” <strong>for</strong> the boys and “F” <strong>for</strong> the girls.)> attach(kid.weights)

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

Saved successfully!

Ooh no, something went wrong!