home *** CD-ROM | disk | FTP | other *** search
- .SET #8(*1, *)
- .LET (*#34=#34+#8*) TEXT
- .LET (*#21=#21+#6*)
- @LAB:SCREEN10
- .SCR 0
- .SNA(*(.INF 39)0*)
- .COL 7,0
- .LOC 2,46(*10*)
- .COL 0,3
- .LOC 5,11(* Contingency Tables *)
- .PAU(**)#4
- .COL 14,0
- .LOC 8,10(*Another important use of the X² distribution is to investigate*)
- .LOC 10,16(*a population which has been split into pre-defined*)
- .LOC 12,14(*categories. It is*)
- .COL 12,0
- .LOC 12,33(*ESSENTIAL*)
- .COL 14,0
- .LOC 12,43(*that these categories are*)
- .COL 11,0
- .LOC 15,32(*MUTUALLY EXCLUSIVE*)
- .PAU(**)#4
- .COL 10,0
- .LOC 18,15(*Our Null Hypothesis, in this case, is always that the*)
- .COL 12,0
- .LOC 20,21(*categories are statistically independent.*)
- .SPE PLAY (*AM140810.SPE*) WAIT
- .PAU(**)#4
- .COL 0,3
- .LOC 24,64(*SPACE >>*)
- .PAU(**)
- @LAB:SCREEN11
- .SCR 0
- .SNA(*(.INF 39)0*)
- .COL 7,0
- .LOC 2,46(*11*)
- .COL 14,0
- .LOC 5,13(*We shall use the X² test in precisely the same way as in*)
- .LOC 7,36(*Module 14.7*)
- .PAU(**)#4
- .COL 12,0
- .LOC 9,13(*An example:*)
- .COL 10,0
- .LOC 11,15(*A population of 1000 schoolchildren was split up according*)
- .LOC 13,15(*to the colour of their hair and the colour of their eyes.*)
- .LOC 15,15(*The results were...*)
- .COL 14,0
- .LOC 15,43(*[ fictitious data ]*)
- .PAU(**)#4
- .COL 0,3
- .LOC 24,64(*SPACE >>*)
- .PAU(**)
- .LOC 24,64(* *)
- .COL 7,0
- .WIP (4,2)-(23,79) #6
- .LOC 2,46(*11a*)
- .COL 14,0
- .LOC 11,38(*Hair Colour*)
- .LOC 12,29(*Black Brown Blond Red*)
- .LOC 15,12(*Eye*)
- .LOC 17,12(*Colour*)
- .LOC 14,21(*Blue*)
- .LOC 16,21(*Brown*)
- .LOC 18,21(*Other*)
- .COL 13,0
- .LOC 11,27(*║*)
- .LOC 11,58(*║*)
- .LOC 12,27(*║*)
- .LOC 12,58(*║*)
- .LOC 13,21(*──────╫──────────────────────────────╫───────*)
- .LOC 14,27(*║ ║*)
- .LOC 15,27(*║ ║*)
- .LOC 16,27(*║ ║*)
- .LOC 17,27(*║ ║*)
- .LOC 18,27(*║ ║*)
- .LOC 19,21(*──────╫──────────────────────────────╫───────*)
- .LOC 20,27(*║ ║*)
- .COL 14,0
- .LOC 20,21(*Totals*)
- .LOC 12,60(*Totals*)
- .COL 10,0
- .LOC 14,30(*110 70 130 40*)
- .LOC 14,62(*350*)
- .LOC 16,31(*20 270 20 40*)
- .LOC 16,62(*350*)
- .LOC 18,31(*50 170 50 30*)
- .LOC 18,62(*300*)
- .LOC 20,30(*180 510 200 110*)
- .LOC 20,61(*1000*)
- .SPE PLAY (*AM140811.SPE*) WAIT
- .PAU(**)#4
- .COL 12,0
- .LOC 22,15(*NULL HYPOTHESIS:*)
- .PAU(**)#4
- .COL 10,0
- .LOC 22,32(*hair colour is independent of eye colour*)
- .PAU(**)#4
- .COL 0,3
- .LOC 24,64(*SPACE >>*)
- .PAU(**)
- .LOC 24,64(* *)
- .COL 7,0
- .WIP (4,2)-(23,79) #6
- .LOC 2,46(*11b*)
- .PAU(**)#2
- .COL 10,0
- .LOC 18,15(*Each individual entry in the table is called a*)
- .COL 11,0
- .LOC 18,62(*CELL*)
- .PAU(**)#4
- .COL 0,3
- .LOC 8,30(*110*)
- .PAU(**)#2
- .COL 10,0
- .LOC 8,30(*110*)
- .COL 0,3
- .LOC 10,47(*20*)
- .PAU(**)#2
- .COL 10,0
- .LOC 10,47(*20*)
- .COL 0,3
- .LOC 12,47(*50*)
- .PAU(**)#2
- .COL 10,0
- .LOC 12,47(*50*)
- .COL 0,3
- .LOC 12,38(*170*)
- .PAU(**)#2
- .COL 10,0
- .LOC 12,38(*170*)
- .PAU(**)#4
- .LOC 20,15(*This Contingency Table has*)
- .COL 11,0
- .LOC 20,43(*3 rows*)
- .COL 0,3
- .LOC 8,70(*«*)
- .LOC 10,70(*«*)
- .LOC 12,70(*«*)
- .PAU(**)#2
- .COL 10,0
- .LOC 8,70(* *)
- .LOC 10,70(* *)
- .LOC 12,70(* *)
- .PAU(**)#2
- .COL 10,0
- .LOC 20,51(*and*)
- .COL 11,0
- .LOC 20,56(*4 columns*)
- .COL 0,3
- .LOC 15,31(*^*)
- .LOC 15,39(*^*)
- .LOC 15,47(*^*)
- .LOC 15,54(*^*)
- .PAU(**)#2
- .COL 10,0
- .LOC 15,30(* *)
- .SPE PLAY (*AM140812.SPE*) WAIT
- .PAU(**)#4
- .COL 0,3
- .LOC 24,64(*SPACE >>*)
- .PAU(**)
- .LOC 24,64(* *)
- .COL 7,0
- .WIP (15,2)-(23,79)
- .LOC 2,46(*12 *)
- .PAU(**)#2
- .COL 14,0
- .LOC 16,11(*From the table, assuming that the cells are independent*)
- .PAU(**)#4
- .COL 10,0
- .LOC 18,18(*the probability of blue eyes is 350 out of 1000*)
- .COL 0,3
- .LOC 8,61(* 350 *)
- .LOC 14,60(* 1000 *)
- .PAU(**)#4
- .COL 14,0
- .LOC 20,26(*»*)
- .COL 10,0
- .LOC 20,33(*p( blue eyes ) = 0.35*)
- .COL 10,0
- .LOC 8,61(* 350 *)
- .LOC 14,60(* 1000 *)
- .PAU(**)#4
- .LOC 22,20(*p( brown eyes ) = 35 out of 1000 = 0.35*)
- .COL 0,3
- .LOC 10,61(* 350 *)
- .LOC 14,60(* 1000 *)
- .PAU(**)#4
- .COL 10,0
- .LOC 10,61(* 350 *)
- .LOC 14,60(* 1000 *)
- .COL 0,3
- .LOC 24,64(*SPACE >>*)
- .PAU(**)
- .LOC 24,64(* *)
- .COL 7,0
- .WIP (15,2)-(23,79) #4
- .LOC 2,46(*12a*)
- .PAU(**)#2
- .COL 10,0
- .LOC 20,19(*p( black hair ) = 180 out of 1000 = 0.18*)
- .COL 0,3
- .LOC 14,29(* 180 *)
- .LOC 14,60(* 1000 *)
- .PAU(**)#4
- .COL 10,0
- .LOC 14,29(* 180 *)
- .LOC 14,60(* 1000 *)
- .LOC 22,21(*p( red hair ) = 110 out of 1000 = 0.11*)
- .COL 0,3
- .LOC 14,52(* 110 *)
- .LOC 14,60(* 1000 *)
- .PAU(**)#4
- .COL 10,0
- .LOC 14,52(* 110 *)
- .LOC 14,60(* 1000 *)
- .PAU(**)#4
- .COL 0,3
- .LOC 24,64(*SPACE >>*)
- .PAU(**)
- .LOC 24,64(* *)
- .COL 7,0
- .WIP (4,2)-(23,79) #11
- .LOC 2,46(*13 *)
- .PAU(**)#2
- .COL 14,0
- .LOC 13,11(*Using Probability Law 4 for statistically independent events:*)
- .PAU(**)#4
- .COL 10,0
- .LOC 15,11(*p( brown eyes*)
- .COL 12,0
- .LOC 15,25(*AND*)
- .COL 10,0
- .LOC 15,29(*red hair ) = p( brown eyes )*)
- .COL 12,0
- .LOC 15,60(*x*)
- .COL 10,0
- .LOC 15,62(*p( red hair )*)
- .SPE PLAY (*AM140813.SPE*) WAIT
- .PAU(**)#4
- .LOC 17,41(*= 0.35 x 0.11*)
- .PAU(**)#4
- .LOC 17,61(*= 0.0385 (1)*)
- .PAU(**)#4
- .LOC 19,11(*Expected frequency for the cell [ brown eyes and red hair ]*)
- .LOC 21,41(*= 1000 x 0.0385*)
- .PAU(**)#4
- .LOC 21,61(*= 38.5 (2)*)
- .COL 0,3
- .LOC 24,64(*C / R >>*)
- @SIN(*"C"=L:SCREEN14,"R"=L:-SCREEN10,"c"=L:SCREEN14,"r"=L:-SCREEN10*)
- @LAB:SCREEN14
- .SNA(*(.INF 39)0*)
- .COL 7,0
- .LOC 2,46(*14*)
- .COL 10,0
- .LOC 7,11(*Note how line (1) could be written as...*)
- .PAU(**)#4
- .COL 14,0
- .LOC 9,34(*350 110*)
- .LOC 10,33(*──── x ────*)
- .LOC 11,33(*1000 1000*)
- .PAU(**)#4
- .COL 10,0
- .LOC 13,11(*and line (2) as...*)
- .PAU(**)#4
- .COL 14,0
- .LOC 15,36(*350 110 350 x 110*)
- .LOC 16,28(*1000 x ──── x ──── = ─────────*)
- .LOC 17,35(*1000 1000 1000*)
- .PAU(**)#4
- .COL 10,0
- .LOC 19,38(*Row Total x Column Total*)
- .LOC 20,17(*Expected frequency = ────────────────────────*)
- .LOC 21,41(*Grand Total*)
- .SPE PLAY (*AM140814.SPE*) WAIT
- .PAU(**)#4
- .WIP (4,2)-(23,79)#14
- .PAU(**)#2
- .LOC 9,11(*You may like to verify for yourself algebraically that this*)
- .LOC 11,27(*expression is a general rule.*)
- .SPE PLAY (*AM140814.SPE*) WAIT
- .PAU(**)#4
- .COL 14,0
- .LOC 15,13(*We can re-draw the table in our example and add expected*)
- .LOC 17,22(*frequencies based on these assumptions.*)
- .PAU(**)#4
- .COL 15,0
- .LOC 20,15(*You may find it convenient to use two colours of pen.*)
- .PAU(**)#4
- .COL 0,3
- .LOC 24,64(*SPACE >>*)
- .PAU(**)
- @LAB:SCREEN15
- .SNA(*(.INF 39)0*)
- .COL 7,0
- .LOC 2,46(*15*)
- .COL 14,0
- .LOC 5,22(*Black Brown Blond Red Totals*)
- .COL 11,0
- .LOC 6,21(*O E O E O E O E O E*)
- .COL 14,0
- .LOC 8,11(*Blue*)
- .LOC 10,11(*Brown*)
- .LOC 12,11(*Other*)
- .LOC 14,11(*Totals*)
- .COL 13,0
- .LOC 5,18(*║*)
- .LOC 5,30(*║*)
- .LOC 5,42(*║*)
- .LOC 5,54(*║*)
- .LOC 5,66(*║*)
- .LOC 6,18(*║*)
- .LOC 6,30(*║*)
- .LOC 6,42(*║*)
- .LOC 6,54(*║*)
- .LOC 6,66(*║*)
- .LOC 6,24(*│*)
- .LOC 6,36(*│*)
- .LOC 6,48(*│*)
- .LOC 6,60(*│*)
- .LOC 6,72(*│*)
- .LOC 7,11(*───────╫─────┼─────╫─────┼─────╫─────┼─────╫─────┼─────╫─────┼─────*)
- .LOC 8,18(*║ │ ║ │ ║ │ ║ │ ║ │*)
- .LOC 9,18(*║ │ ║ │ ║ │ ║ │ ║ │*)
- .LOC 10,18(*║ │ ║ │ ║ │ ║ │ ║ │*)
- .LOC 11,18(*║ │ ║ │ ║ │ ║ │ ║ │*)
- .LOC 12,18(*║ │ ║ │ ║ │ ║ │ ║ │*)
- .LOC 13,11(*───────╫─────┼─────╫─────┼─────╫─────┼─────╫─────┼─────╫─────┼─────*)
- .LOC 14,18(*║ │ ║ │ ║ │ ║ │ ║ │*)
- .COL 10,0
- .LOC 8,20(*110*)
- .LOC 8,33(*70*)
- .LOC 8,44(*130*)
- .LOC 8,57(*40*)
- .LOC 8,68(*350*)
- .LOC 10,21(*20*)
- .LOC 10,32(*270*)
- .LOC 10,45(*20*)
- .LOC 10,57(*40*)
- .LOC 10,68(*350*)
- .LOC 12,21(*50*)
- .LOC 12,32(*170*)
- .LOC 12,45(*50*)
- .LOC 12,57(*30*)
- .LOC 12,68(*300*)
- .LOC 14,20(*180*)
- .LOC 14,32(*510*)
- .LOC 14,44(*200*)
- .LOC 14,56(*110*)
- .LOC 14,67(*1000*)
- .PAU(**)#4
- .COL 12,0
- .LOC 8,27(*63*)
- .PAU(**)#2
- .LOC 10,27(*63*)
- .PAU(**)#2
- .LOC 12,27(*54*)
- .PAU(**)#2
- .LOC 14,26(*180*)
- .PAU(**)#4
- .LOC 8,37(*178.5*)
- .PAU(**)#2
- .LOC 10,37(*178.5*)
- .PAU(**)#2
- .LOC 12,38(*153*)
- .PAU(**)#2
- .LOC 14,38(*510*)
- .PAU(**)#4
- .LOC 8,50(*70*)
- .PAU(**)#2
- .LOC 10,50(*70*)
- .PAU(**)#2
- .LOC 12,50(*60*)
- .PAU(**)#2
- .LOC 14,49(*200*)
- .PAU(**)#4
- .LOC 8,62(*38.5*)
- .PAU(**)#2
- .LOC 10,62(*38.5*)
- .PAU(**)#2
- .LOC 12,62(*33*)
- .PAU(**)#2
- .LOC 14,62(*110*)
- .PAU(**)#
- .LOC 8,74(*350*)
- .PAU(**)#2
- .LOC 10,74(*350*)
- .PAU(**)#2
- .LOC 12,74(*300*)
- .PAU(**)#2
- .LOC 14,73(*1000*)
- .PAU(**)#4
- .COL 14,0
- .LOC 17,9(*In this particular example, the sums of the expected frequencies*)
- .LOC 19,11(*agree with those of the observed ones. Rounding errors can *)
- .LOC 21,14(*prevent this but any differences should be very small.*)
- .PAU(**)#4
- .COL 0,3
- .LOC 24,64(*SPACE >>*)
- .PAU(**)
- .LOC 24,64(* *)
- .COL 7,0
- .WIP (16,2)-(23,79)
- .LOC 2,46(*15a*)
- .PAU(**)#2
- .COL 14,0
- .LOC 17,11(*Now we can calculate X² by adding up the*)
- .COL 12,0
- .LOC 16,52(*( O - E )²*)
- .LOC 17,53(*───────*)
- .LOC 18,56(*E*)
- .COL 14,0
- .LOC 17,63(*for each cell.*)
- .SPE PLAY (*AM140815.SPE*) WAIT
- .PAU(**)#4
- .COL 10,0
- .LOC 21,14(*X² =*)
- .LOC 20,21(*(110 - 63)²*)
- .LOC 21,22(*────────*)
- .LOC 22,25(*63*)
- .PAU(**)#4
- .LOC 21,33(*+*)
- .LOC 20,35(*(70 - 178.5)²*)
- .LOC 21,36(*──────────*)
- .LOC 22,39(*178.5*)
- .PAU(**)#4
- .LOC 21,49(*+*)
- .LOC 20,51(*(130 - 70)²*)
- .LOC 21,52(*────────*)
- .LOC 22,56(*70*)
- .PAU(**)#4
- .LOC 21,63(*+*)
- .COL 12,0
- .LOC 20,66(*for all*)
- .LOC 22,66(*12 cells*)
- .PAU(**)#4
- .COL 0,3
- .LOC 24,64(*SPACE >>*)
- .PAU(**)
- .LOC 24,64(* *)
- .COL 7,0
- .WIP (15,2)-(23,79) #4
- .LOC 2,46(*15b*)
- .PAU(**)#2
- .COL 10,0
- .LOC 20,18(*= 35.06 + 65.95 + 51.43 + 0.06 + 29.35 + 46.90 + 35.71*)
- .LOC 22,23(*+ 0.06 + 0.30 + 1.89 + 1.67 + 0.27*)
- .PAU(**)#4
- .LOC 22,59(*= 268.65*)
- .COL 0,3
- .LOC 24,64(*C / R >>*)
- @SIN(*"C"=L:SCREEN16,"R"=L:-SCREEN14,"c"=L:SCREEN16,"r"=L:-SCREEN14*)
- @LAB:SCREEN16
- .SNA(*(.INF 39)0*)
- .COL 7,0
- .LOC 2,46(*16*)
- .COL 14,0
- .LOC 5,15(*Now we need to look at the Degrees of Freedom to use.*)
- .PAU(**)#4
- .COL 12,0
- .LOC 8,11(*For the rows:*)
- .PAU(**)#4
- .COL 10,0
- .LOC 8,28(*we made the totals of the rows agree so*)
- .LOC 10,28(*we could choose all but one of them*)
- .PAU(**)#4
- .COL 11,0
- .LOC 12,28(*number of rows - 1 constraint*)
- .PAU(**)#4
- .COL 14,0
- .LOC 12,62(*»*)
- .COL 11,0
- .LOC 12,66(*r - 1*)
- .PAU(**)#4
- .COL 12,0
- .LOC 14,11(*and columns:*)
- .PAU(**)#4
- .COL 10,0
- .LOC 14,28(*we made the totals of the columns agree so*)
- .LOC 16,28(*we could choose all but one of them*)
- .PAU(**)#4
- .COL 11,0
- .LOC 18,28(*number of columns - 1 constraint*)
- .PAU(**)#4
- .COL 14,0
- .LOC 18,62(*»*)
- .COL 11,0
- .LOC 18,66(*c - 1*)
- .PAU(**)#4
- .COL 10,0
- .LOC 20,18(*Degrees of Freedom = ( r - 1 ) x ( c - 1 )*)
- .LOC 22,38(*= ( 3 - 1 ) x ( 4 - 1 ) = 6*)
- .PAU(**)#4
- .COL 0,3
- .LOC 24,64(*SPACE >>*)
- .PAU(**)
- @LAB:SCREEN17
- .SCR 2
- .SNA(*(.INF 39)2*)
- .LOC 2,46(*17*)
- .PUT 183,29 PART=6
- .LOC 5,27(*= 268.65*)
- .PUT 344,31 PART=7
- .LOC 5,47(*= 6*)
- .PAU(**)#4
- .LOC 7,15(*Enter your*)
- .PUT 200,45 PART=6
- .LOC 7,29(*table at*)
- .PUT 304,47 PART=7
- .LOC 7,41(*= 6, level 5 %*)
- .PAU(**)#4
- .LOC 7,60(*» 12.59*)
- .PAU(**)#4
- .LOC 9,16(*268.65 IS ≥ 12.59 so the result is SIGNIFICANT*)
- .PAU(**)#4
- .LOC 12,9(*In fact, it is still highly significant even at the 0.1 % level !*)
- .PAU(**)#4
- .LOC 15,11(*We reject the Null Hypothesis and the Alternate Hypothesis*)
- .LOC 17,12(*that the categories are NOT INDEPENDENT would be adopted.*)
- .PAU(**)#4
- .USE PROG=PAUSE.USE
- .WIP (4,2)-(23,79) #3
- .LOC 2,46(*17a*)
- .PAU(**)#2
- .LOC 17,11(*The result is as you should expect:*)
- .PAU(**)#4
- .LOC 19,17(*brown hair is usually associated with brown eyes*)
- .LOC 21,17(*blond hair is usually associated with blue eyes.*)
- .PUT 500,187 PART=2 PSET
- @SIN(*"C"=L:SCREEN17Z,"R"=L:-SCREEN11,"c"=L:SCREEN17Z,"r"=L:-SCREEN11*)
- @LAB:SCREEN17Z
- @GOB:SCREEN18 PROG=AM1408B1.CHA
-
-