X^2 test of independence Table #11.1.1: Autism Versus Breastfeeding Autism Breast Feeding Timelines Row None Less 2 to 6 More Total than 2 months than 6 months months Yes 241 198 164 215 818 No 20 25 27 44 116 Column261 223 191 259 934 Total Data for my code: 241 198 164 215 20 25 27 44 Table #11.1.3: Number of Leprosy Cases WHO Region World Bank Income Group Row Total High Income Upper Middle Income Lower Middle Income Low Income Americas 174 36028 615 0 36817 EasternMediterranean 54 6 1883 604 2547 Europe 10 0 0 0 10 WesternPacific 26 216 3689 1155 5086 Africa 0 39 1986 15928 17953 South-EastAsia 0 0 149896 10236 160132 Column Total 264 36289 158069 27923 222545 Data only: 174 36028 615 0 54 6 1883 604 10 0 0 0 26 216 3689 1155 0 39 1986 15928 0 0 149896 10236 X^2=328594. p-value=0 15 20 30 35 5 15 X^2=2.84 p-value=0.24 10 12 7 10 25 34 X^2=0.0858 p-value=0.9579 7 28 13 52 X^2=0 p-value=1 Independent 10 16 90 84 X^2=1.59 p-value=0.207 57 72 61 40 22 49 68 55 32 20 X^2=0.366 p-value=0.985 "almost" independent? *************************************************************** X^2 test of goodness-of-fit Die rolls 1 2 3 4 5 6 Total Observed Frequencies 78 87 87 76 85 87 500 Expected Proportion .166 .166 .166 .166 .166 .166 83.33 83.33 83.33 83.33 83.33 83.33 Table #11.2.3: M&M Observed and Proportions Blue Brown Green Orange Red Yellow Total Observed Frequencies 481 371 483 544 372 369 2620 Expected Proportion 0.24 0.13 0.16 0.20 0.13 0.14 629 341 419 524 341 367 Table #11.2.5: Renal Failure Frequencies Age Group 16-29 30-44 45-59 60-75 75+ Total Observed Frequency 32 66 132 218 91 539 Expected Proportion 0.23 0.25 0.22 0.21 0.09 124 135 119 114 48 Rock_Paper-Scissors 235 194 171 200 200 200 X^2=10.5 p-value=.005 *************************************************************** ANOVA Table #11.3.1: Survival Times in Days of Five Cancer Types Stomach Bronchus Colon Ovary Breast 124 81 248 1234 1235 42 461 377 89 24 25 20 189 201 1581 45 450 1843 356 1166 412 246 180 2970 40 51 166 537 456 727 1112 63 519 3808 46 64 455 791 103 155 406 1804 876 859 365 3460 146 151 942 719 340 166 776 396 37 372 223 163 138 101 72 20 245 283 Convert to rows: paste into Excel. Data|Text to columns then copy each row, Paste Transpose Stomach Bronchus Colon Ovary Breast 124 42 25 45 412 51 1112 46 103 876 146 340 396 81 461 20 450 246 166 63 64 155 859 151 166 37 223 138 72 245 248 377 189 1843 180 537 519 455 406 365 942 776 372 163 101 20 283 1234 89 201 356 2970 456 1235 24 1581 1166 40 727 3808 791 1804 3460 719 Another example: rows: 4 rice varieties, cols:yields 934 1041 1028 935 880 963 924 946 987 953 976 840 992 1143 1140 1191 F:7.18 p-value:.0051 Fisher's amoeba beakers 72 69 63 59 59 53 51 74 72 70 69 66 58 52 78 74 70 58 58 56 56 69 67 66 64 62 58 54 F: .525 p-value=.669