12.07.2015 Views

Analytical Chem istry - DePauw University

Analytical Chem istry - DePauw University

Analytical Chem istry - DePauw University

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.

128 <strong>Analytical</strong> <strong>Chem</strong><strong>istry</strong> 2.0> t.test(penny1, penny2, var.equal=TRUE)Two Sample t-testdata: penny1 and penny2t = 1.3345, df = 10, p-value = 0.2116alternative hypothesis: true difference in means is not equal to 095 percent confidence interval:-0.02403040 0.09580182sample estimates:mean of x mean of y3.117286 3.081400Figure 4.26 Output of an R session for an unpaired t-test with equal variances. The p-value of 0.2116 is theprobability of incorrectly rejecting the null hypothesis that the means are equal (note: R identifies the value a asa p-value). The 95% confidence interval is the range of values for the difference between the means that can beexplained by random error. If this range includes the expected value for the difference, in this case zero, thenthere is insufficient evidence to reject the null hypothesis. Note that R does not adjust for significant figures.Practice Exercise 4.13Rework Example 4.20 and Example 4.21 using R.Click here to review your answers to this exercise.You need to install a package once, butyou need to load the package each timeyou plan to use it. There are ways to configureR so that it automatically loadscertain packages; see An Introduction to Rfor more information (click here to view aPDF version of this document).Unlike Excel, R also includes functions for evaluating outliers. Thesefunctions are not part of R’s standard installation. To install them enter thefollowing command within R (note: you will need an internet connection todownload the package of functions).> install.packages(“outliers”)After installing the package, you will need to load the functions into R usingthe following command (note: you will need to do this step each time you begina new R session as the package does not automatically load when you start R).> library(“outliers”)Let’s use this package to find the outlier in Table 4.16 using bothDixon’s Q-test and Grubb’s test. The commands for these tests aredixon.test(X, type = 10, two.sided = TRUE)grubbs.test(X, type = 10, two.sided = TRUE)where X is the object containing the data, “type = 10” specifies that weare looking for one outlier, and “two.sided=TRUE” indicates that we areusing the more conservative two-tailed test. Both tests have other variantsthat allow the testing of outliers on both ends of the data set (“type = 11”)or for more than one outlier (“type = 20”), but we will not consider these.Figure 4.27 shows the output of a session for this problem. For both teststhe very small p-value indicates that we can treat as an outlier the pennywith a mass of 2.514 g.

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

Saved successfully!

Ooh no, something went wrong!