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.

Bivariate data 81Figure 3.6 Assessed values of homesin Maplewood, N.J. in 1970 and 2000Figure 3.6 shows the scatterplot. The data falls more or less along a straight line, althoughwith some variation. A few questions immediately come to mind. For instance, what arethe distributions of each variable like? What is the change in price?> summary(y1970)Min. 1st Qu. Median Mean 3rd Qu. Max.20300 57000 68500 71300 83500 139000> summary(y2000)Min. 1st Qu. Median Mean 3rd Qu. Max.51600 163000 260000 274000 342000 745000 260000> summary(y2000/y1970)Min. 1st Qu. Median Mean 3rd Qu. Max.2.10 2.89 3.80 3.68 4.30 5.97detach(homedata)# tidy upFor the 1970 data, the mean and the median are nearly the same. Not so <strong>for</strong> the 2000 data.Property values are often skewed right. In this sampling, some houses went up in valuejust over two times and others nearly six times. On average they went up 3.68 times.When one is buying a home, it is obviously desirable to figure out which homes arelikely to appreciate more than others.■ Example 3.3: Does the weather predict the stock market? As a large amount ofstock traders work in New York City, it may be true that unseasonably good or badweather there affects the per<strong>for</strong>mance of the stock market. The data set maydow(<strong>Using</strong>R) contains data <strong>for</strong> the Dow Jones Industrial Average (DJIA) and maximumtemperatures in Central Park <strong>for</strong> May 2003. This month was unseasonably cool and wet.The data set contains only maximum temperature, so we can ask <strong>for</strong> that month, whetherthere was a relationship between maximum temperature and the stock market?> attach(maydow)> names(maydow)[1] "Day" "DJA" "max.temp"

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

Saved successfully!

Ooh no, something went wrong!