> frisbee Grip Distance 1 Finger_Out 33 2 Finger_Out 32 3 Finger_Out 23 4 Finger_Out 36 5 Finger_Out 26 6 Finger_Out 27 7 Finger_Out 30 8 Finger_Out 29 9 Normal 39 10 Normal 34 11 Normal 36 12 Normal 37 13 Normal 30 14 Normal 28 15 Normal 30 16 Normal 31 17 Inverted 33 18 Inverted 34 19 Inverted 36 20 Inverted 37 21 Inverted 30 22 Inverted 28 23 Inverted 30 24 Inverted 31 > mean(Distance) [1] 31.66667 > mean(Distance[Grip=='Inverted']) [1] 32.375 > mean(Distance[Grip=='Inverted']) - mean(Distance) [1] 0.7083333 > anova(lm(Distance ~ Grip)) Analysis of Variance Table Response: Distance Df Sum Sq Mean Sq F value Pr(>F) Grip 2 58.583 29.292 2.0453 0.1543 Residuals 21 300.750 14.321 > cereal[1:20,] NAME CALORIES PROTEIN FAT SODIUM FIBER CARBO SUGARS SHELF 1 100%_Bran 70 4 1 130 10.0 5.0 6 3 2 100%_Natural_Bran 120 3 5 15 2.0 8.0 8 3 3 All-Bran 70 4 1 260 9.0 7.0 5 3 4 All-Bran_with_Extra_Fiber 50 4 0 140 14.0 8.0 0 3 5 Almond_Delight 110 2 2 200 1.0 14.0 8 3 6 Apple_Cinnamon_Cheerios 110 2 2 180 1.5 10.5 10 1 7 Apple_Jacks 110 2 0 125 1.0 11.0 14 2 8 Basic_4 130 3 2 210 2.0 18.0 8 3 9 Bran_Chex 90 2 1 200 4.0 15.0 6 1 10 Bran_Flakes 90 3 0 210 5.0 13.0 5 3 11 Cap'n'Crunch 120 1 2 220 0.0 12.0 12 2 12 Cheerios 110 6 2 290 2.0 17.0 1 1 13 Cinnamon_Toast_Crunch 120 1 3 210 0.0 13.0 9 2 14 Clusters 110 3 2 140 2.0 13.0 7 3 15 Cocoa_Puffs 110 1 1 180 0.0 12.0 13 2 16 Corn_Chex 110 2 0 280 0.0 22.0 3 1 17 Corn_Flakes 100 2 0 290 1.0 21.0 2 1 18 Corn_Pops 110 1 0 90 1.0 13.0 12 2 19 Count_Chocula 110 1 1 180 0.0 12.0 13 2 20 Cracklin'_Oat_Bran 110 3 3 140 4.0 10.0 7 3 > boxplot(SUGARS ~ factor(SHELF)) > residuals(lm(SUGAR ~ factor(SHELF))) Error in eval(expr, envir, enclos) : object 'SUGAR' not found > residuals(lm(SUGARS ~ factor(SHELF))) 1 2 3 4 5 6 7 8 9 -0.5277778 1.4722222 -1.5277778 -6.5277778 1.4722222 5.2000000 4.3809524 1.4722222 1.2000000 10 11 12 13 14 15 16 17 18 -1.5277778 2.3809524 -3.8000000 -0.6190476 0.4722222 3.3809524 -1.8000000 -2.8000000 2.3809524 19 20 21 22 23 24 25 26 27 3.3809524 0.4722222 -9.6190476 -3.5277778 3.4722222 -1.5277778 3.3809524 6.2000000 -2.6190476 28 29 30 31 32 33 34 35 36 3.4722222 5.4722222 2.3809524 10.2000000 -0.6190476 -1.5277778 -3.5277778 -2.5277778 1.3809524 37 38 39 40 41 42 43 44 45 5.2000000 6.2000000 -0.5277778 2.4722222 -6.6190476 -3.6190476 2.3809524 -6.6190476 4.4722222 46 47 48 49 50 51 52 53 54 4.4722222 6.4722222 1.2000000 -0.6190476 0.4722222 -4.5277778 3.4722222 7.4722222 -3.5277778 55 56 57 58 59 60 61 62 63 -6.5277778 -6.5277778 -0.5277778 -5.8000000 2.3809524 1.4722222 -0.5277778 -2.8000000 -1.8000000 64 65 66 67 68 69 70 71 72 -4.8000000 -4.8000000 -4.8000000 5.3809524 -1.8000000 -4.6190476 -3.5277778 7.4722222 -3.5277778 73 74 75 76 77 -3.5277778 2.3809524 -1.8000000 -1.8000000 3.2000000 > hist(residuals(lm(SUGARS ~ factor(SHELF)))) > hist(SUGARS[SHELF==1]) > plot(lm(SUGARS ~ factor(SHELF))) Hit to see next plot: Hit to see next plot: Hit to see next plot: Hit to see next plot: > cereal[31,] NAME CALORIES PROTEIN FAT SODIUM FIBER CARBO SUGARS SHELF 31 Golden_Crisp 100 2 0 45 0 11 15 1 > anova(lm(SUGARS ~ factor(SHELF))) Analysis of Variance Table Response: SUGARS Df Sum Sq Mean Sq F value Pr(>F) factor(SHELF) 2 248.41 124.204 7.3345 0.001242 ** Residuals 74 1253.12 16.934 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > boxplot(SUGARS ~ factor(SHELF)) > t.test(SUGARS[SHELF==2], SUGARS[SHELF!=2]) Welch Two Sample t-test data: SUGARS[SHELF == 2] and SUGARS[SHELF != 2] t = 3.5034, df = 36.195, p-value = 0.001242 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 1.562007 5.854660 sample estimates: mean of x mean of y 9.619048 5.910714 > cereal[1:20,] NAME CALORIES PROTEIN FAT SODIUM FIBER CARBO SUGARS SHELF 1 100%_Bran 70 4 1 130 10.0 5.0 6 3 2 100%_Natural_Bran 120 3 5 15 2.0 8.0 8 3 3 All-Bran 70 4 1 260 9.0 7.0 5 3 4 All-Bran_with_Extra_Fiber 50 4 0 140 14.0 8.0 0 3 5 Almond_Delight 110 2 2 200 1.0 14.0 8 3 6 Apple_Cinnamon_Cheerios 110 2 2 180 1.5 10.5 10 1 7 Apple_Jacks 110 2 0 125 1.0 11.0 14 2 8 Basic_4 130 3 2 210 2.0 18.0 8 3 9 Bran_Chex 90 2 1 200 4.0 15.0 6 1 10 Bran_Flakes 90 3 0 210 5.0 13.0 5 3 11 Cap'n'Crunch 120 1 2 220 0.0 12.0 12 2 12 Cheerios 110 6 2 290 2.0 17.0 1 1 13 Cinnamon_Toast_Crunch 120 1 3 210 0.0 13.0 9 2 14 Clusters 110 3 2 140 2.0 13.0 7 3 15 Cocoa_Puffs 110 1 1 180 0.0 12.0 13 2 16 Corn_Chex 110 2 0 280 0.0 22.0 3 1 17 Corn_Flakes 100 2 0 290 1.0 21.0 2 1 18 Corn_Pops 110 1 0 90 1.0 13.0 12 2 19 Count_Chocula 110 1 1 180 0.0 12.0 13 2 20 Cracklin'_Oat_Bran 110 3 3 140 4.0 10.0 7 3 > boxplot(SUGARS ~ factor(FAT)) > summary(FAT) Min. 1st Qu. Median Mean 3rd Qu. Max. 0.000 0.000 1.000 1.013 2.000 5.000 > summary(factor(FAT)) 0 1 2 3 5 27 30 14 5 1 > boxplot(SUGAR ~ (FAT>0)) Error in eval(expr, envir, enclos) : object 'SUGAR' not found > boxplot(SUGARS ~ (FAT>0)) > hist(lm(SUGARS ~ (FAT>0))) Error in hist.default(lm(SUGARS ~ (FAT > 0))) : 'x' must be numeric > hist(residuals(lm(SUGARS ~ (FAT>0)))) > anova((lm(SUGARS ~ (FAT>0)))) Analysis of Variance Table Response: SUGARS Df Sum Sq Mean Sq F value Pr(>F) FAT > 0 1 204.62 204.623 11.833 0.0009536 *** Residuals 75 1296.91 17.292 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > boxplot(SUGARS ~ (FAT>0))