> # Oskar Hagberg 2012-02-15 > # Question > # > # Is there a difference in mean performance between the Karlsruhe and Lehigh > # Method in the accuracy of preidicting sheer strength? > # > # Experiment to answer the question > # > # Nine giders were tested both with the K and the L method. The results were - > # expressed the ratio between predicted and observed > Karlsruhe = + c(1.186,1.151,1.322,1.339,1.2,1.402,1.365,1.537,1.559) > > Lehigh = + c(1.061,0.992,1.063,1.062,1.065,1.178,1.037,1.086,1.052) > > # Since the first observations in each vector is from the first girder, > # the second from the second girder, and so on, the analysis of choice > # is a paired t-test, where we suppose differences > # are N(delta,sigma^2) distributed and test > # H0: delta = 0 > # aginst > # H1: delta <> 0, > # i.e. a two-sided test should be used > # > # We analyse > dy = Karlsruhe-Lehigh > > plot( + c(0,dy), + rep(1,1+length(dy)), + type = "n", + ylab = "", + xlab = "Difference between the quotients", + axes = FALSE, + main = "Figure 1" + ) > > axis(1) > grid() > > > points( + dy, + rep(1,length(dy)), + pch =16, + cex = 1.5, + col = "dark red" + ) > > # As we see NOT A SINGLE observation is below 0, which > # actually settles the case: there IS actually a difference,., > # but let us do the analysis for completeness. > > SD = sd(dy) > > SDerror = SD/sqrt(length(dy)) > MEAN = mean(dy) > (teststat = MEAN/SDerror) [1] 6.081939 > > # Under H0, the test statistic is t(8) distributed, and the > # Pvalue is > # > (1-pt(teststat,8))*2 [1] 0.0002952955 > > # To investigate the normality assumption, I first > # make qq-plots separately in the two groups: > qqnorm(Karlsruhe,main = "Figure 2: QQnorm for Karlruhe") > > qqnorm(Lehigh,main = "Figure 3: QQnorm for Lehigh") > # This I only did since Montgomery told me to, actually, what > # matters is the normality of the differences. > > qqnorm(dy,main = "Figure 4: QQnorm for the difference") > > # f) About the normality assumtion in the > # paired t-test: First of all, only the difference neads > # to be normal, so amongst the qqplots, actually only > # the one in Figure 4 makes sense.. Moreover, the normality > # assumtion is not vital anyway. >