# We worked with a stereogram fusion data set (described in the Powerpoint for today). # Here are the data: > fusion <- read.csv("http://faculty.ucmerced.edu/jvevea/classes/105/data/fusion.csv") > head(fusion) Time Image 1 47.20001 No 2 21.99998 No 3 20.39999 No 4 19.70001 No 5 17.40000 No 6 14.70000 No > attach(fusion) # We compare means and standard deviations: > tapply(Time, Image, mean) No Yes 8.560465 5.551429 > tapply(Time, Image, sd) No Yes 8.085412 4.801739 # Hmm... It looks like the two populations may differ both in their means # and in their standard deviations, based on what we see in the samples. # An additional complication is that both distributions are positively skewed: > tapply(Time, Image, stem) The decimal point is 1 digit(s) to the right of the | 0 | 2222222223333444 0 | 5566678888999 1 | 00002233 1 | 57 2 | 002 2 | 3 | 3 | 4 | 4 | 7 The decimal point is at the | 0 | 01246778 2 | 03478933568 4 | 699 6 | 00134 8 | 6697 10 | 12 | 14 | 49 16 | 2 18 | 7 $` No` NULL $` Yes` NULL > tapply(Time, Image, pskew) No Yes 0.6160965 1.2192014 > > table(Image) Image No Yes 43 35 > length(Time) [1] 78 > qqnorm(Time[1:43]); qqline(Time[1:43]) > qqnorm(Time[44:78]); qqline(Time[44:78]) # Ignoring problems with independence, we proceed with a pooled-variance # t test. The result is just barely nonsignificant: > t.test(Time~Image, var.equal=TRUE) Two Sample t-test data: Time by Image t = 1.9395, df = 76, p-value = 0.05615 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.0809383 6.0990099 sample estimates: mean in group No mean in group Yes 8.560465 5.551429 # If we do the form of the t test that doesn't pool the variances and # uses Satterthwaite's approximate degrees of freedom, the results are # just barely significant: > t.test(Time~Image) Welch Two Sample t-test data: Time by Image t = 2.0384, df = 70.039, p-value = 0.04529 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.06493122 5.95314037 sample estimates: mean in group No mean in group Yes 8.560465 5.551429 # In response to a student question, I showed you that you can always # get the last n commands issued in R using the history(n) command: > history(23) > # We spent the rest of the class working with Bayesian analyses of the # same data set, including two that essentially duplicate the t tests, and # one that more appropriately models the data as gamma distributed rather # than normally distributed. The code is posted.