12.07.2015 Views

Analytical Chem istry - DePauw University

Analytical Chem istry - DePauw University

Analytical Chem istry - DePauw University

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Chapter 4 Evaluating <strong>Analytical</strong> Data129> penny3=c(3.067,3.049, 3.039, 2.514, 3.048, 3.079, 3.094, 3.109, 3.102)> dixon.test(penny3, type=10, two.sided=TRUE)Dixon test for outliersdata: penny3Q = 0.8824, p-value < 2.2e-16alternative hypothesis: lowest value 2.514 is an outlier> grubbs.test(penny3, type=10, two.sided=TRUE)Grubbs test for one outlierdata: penny3G = 2.6430, U = 0.0177, p-value = 1.938e-06alternative hypothesis: lowest value 2.514 is an outlierFigure 4.27 Output of an R session for Dixon’s Q-test and Grubb’s test for outliers. The p-values for both testsshow that we can treat as an outlier the penny with a mass of 2.514 g.Visualizing Da t aOne of the more useful features of R is the ability to visualize your data.Visualizing your data is important because it provides you with an intuitivefeel for your data that can help you in applying and evaluating statisticaltests. It is tempting to believe that a statistical analysis is foolproof, particularlyif the probability for incorrectly rejecting the null hypothesis is small.Looking at a visual display of your data, however, can help you determinewhether your data is normally distributed—a requirement for most of thesignificance tests in this chapter—and can help you identify potential outliers.There are many useful ways to look at your data, four of which weconsider here.To plot data in R will use the package “lattice,” which you will need toload using the following command.> library(“lattice”)To demonstrate the types of plots we can generate, we will use the object“penny,” which contains the masses of the 100 pennies in Table 4.13.Our first display is a histogram. To construct the histogram we usemass to divide the pennies into bins and plot the number of pennies or thepercent of pennies in each bin on the y-axis as a function of mass on thex-axis. Figure 4.28a shows the result of entering> histogram(penny, type = “percent”, xlab = “Mass (g)”,ylab = “Percent of Pennies”, main = “Histogram of Data in Table4.13”)Visualizing data is important, a point wewill return to in Chapter 5 when we considerthe mathematical modeling of data.You do not need to use the command install.packagethis time because lattice wasautomatically installed on your computerwhen you downloaded R.You can download the file “Penny.Rdata”from the textbook’s web site.To create a histogram showing the numberof pennies in each bin, change “percent”to “count.”

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

Saved successfully!

Ooh no, something went wrong!