11.07.2015 Views

Preface to First Edition - lib

Preface to First Edition - lib

Preface to First Edition - lib

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

30 DATA ANALYSIS USING GRAPHICAL DISPLAYSR> layout(matrix(1:2, nrow = 2))R> par(mar = par("mar") * c(0.8, 1, 1, 1))R> boxplot(USmelanoma$mortality, ylim = xr, horizontal = TRUE,+ xlab = "Mortality")R> hist(USmelanoma$mortality, xlim = xr, xlab = "", main = "",+ axes = FALSE, ylab = "")R> axis(1)100 150 200 250Mortality100 150 200 250Figure 2.1His<strong>to</strong>gram (<strong>to</strong>p) and boxplot (bot<strong>to</strong>m) of malignant melanoma mortalityrates.Calling the layout function on a matrix with two cells in two rows, containingthe numbers one and two, leads <strong>to</strong> such a partitioning. The boxplot functionis called first on the mortality data and then the hist function, where therange of the x-axis in both plots is defined by (77.4, 251.9). One tiny problem<strong>to</strong> solve is the size of the margins; their defaults are <strong>to</strong>o large for such a plot.As with many other graphical parameters, one can adjust their value for aspecific plot using function par. The R code and the resulting display aregiven in Figure 2.1.Both the his<strong>to</strong>gram and the boxplot in Figure 2.1 indicate a certain skewnessof the mortality distribution. Looking at the characteristics of all themortality rates is a useful beginning but for these data we might be moreinterested in comparing mortality rates for ocean and non-ocean states. So wemight construct two his<strong>to</strong>grams or two boxplots. Such a parallel boxplot, vi-© 2010 by Taylor and Francis Group, LLC

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

Saved successfully!

Ooh no, something went wrong!