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.

Chapter 4 Evaluating <strong>Analytical</strong> Data127> var.test(penny1, penny2)F test to compare two variancesdata: penny1 and penny2F = 1.8726, num df = 6, denom df = 4, p-value = 0.5661alternative hypothesis: true ratio of variances is not equal to 195 percent confidence interval:0.2036028 11.6609726sample estimates:ratio of variances1.872598R calculates F exp as (s X ) 2 /(s Y ) 2 . If we usethe commandvar.test(penny2, penny1)the output will give R as 0.534 and the95% confidence interval as 0.0858 to4.912. Because the expected value forF exp of 1.00 falls within the confidenceinterval, we retain the null hypothesis ofequal variances.Figure 4.25 Output of an R session for an F-test of variances. The p-value of 0.5661 is the probability of incorrectlyrejecting the null hypothesis that the variances are equal (note: R identifies the value a as a p-value). The95% confidence interval is the range of values for F exp that can be explained by random error. If this range includesthe expected value for F, in this case 1.00, then there is insufficient evidence to reject the null hypothesis.Note that R does not adjust for significant figures.R also provides the probability of incorrectly rejecting the null hypothesis,which in this case is 0.5561.Having found no evidence suggesting unequal variances, we now completean unpaired t-test assuming equal variances. Our null hypothesis is thatthere is no difference between the means, X = X , and our alternativeSet1 Set2hypothesis is that there is a difference between the means, X ≠ X . InSet1 Set2R there is a single command for all two-sample t-tests. The basic syntax fora two-tailed unpaired t-test with unequal variances ist.test(X, Y, mu = 0, paired = FALSE, var.equal = FALSE)where X and Y are the objects containing the data sets. You can changethe underlined terms to alter the nature of the t-test. Replacing “var.equal= FALSE” to “var.equal = TRUE” makes this a two-tailed t-test with equalvariances, and replacing “paired = FALSE” with “paired = TRUE” makesthis a paired t-test. The term “mu = 0” is the expected difference betweenthe means, which for a null hypothesis of X = XSet1 Set2is 0. You can, ofcourse, change this to suit your needs. The underlined terms are defaultvalues; if you omit them, then R assumes that you intend an unpaired twotailedt-test of the null hypothesis that X = Y with unequal variances. Figure4.26 shows the output of an R session for this problem.The p-value of 0.2116 means that there is a 21.16% probability ofincorrectly rejecting the null hypothesis. The 95% confidence interval of-0.024 to 0.0958, which is for the difference between the sample means,includes the expected value of zero. Both ways of looking at the results ofthe t-test provide no evidence for rejecting the null hypothesis; thus, weretain the null hypothesis and find no evidence for a difference betweenthe two samples.To complete a one-sided t-test, includethe commandoralternative = “greater”alternative = “less”A one-sided paired t-test that the differencebetween two samples is greater than0 becomest.test(X, Y, paired = TRUE, alternative =“greater”)

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

Saved successfully!

Ooh no, something went wrong!