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.

Univariate data 45Figure 2.8 The median is the middlepoint, the mean the balance pointThe trimmed meanA modification of the mean that makes it more resistant is the trimmed mean. Tocompute the trimmed mean, we compute the mean after “trimming” a certain percentageof the smallest and largest values from the data. Consequently, if there are a few valuesthat skew the mean, they won’t skew the trimmed mean.The mean() function can be used with the trim= argument to compute a trimmedmean. Its value is the proportion to be trimmed from both sides.■ Example 2.5: Income distributions are skewedThe cfb (<strong>Using</strong>R) data set contains a sampling of the data contained in the Survey ofConsumer Finances conducted in the year 2001 by the U.S. Federal Reserve Board. Manyof the variables have some values much bigger than the bulk of the data. This is commonin income distributions, as some <strong>for</strong>tunate people accumulate enormous wealth in alifetime, but few can accumulate enormous debt.The INCOME variable contains yearly income figures by household. For this data, wecompare the different measures of center.> income=cfb$INCOME> mean(income)[1] 63403> median(income)[1] 38033> mean(income, trim=.2)[1] 41992> sum(income

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

Saved successfully!

Ooh no, something went wrong!