home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 16
/
016.d81
/
fisher
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
10KB
|
372 lines
10 rem
11 print"[147]"chr$(142):poke53281,0:poke53280,6
12 printspc(8)"loadstar 2x2 statistics":print""spc(9)"written by al vekovius
13 [153]" converted to the c-64 by alan gardner"
14 [153]""[166]12)"copyright 1985"
15 [153]" loadstar is not public domain."
16 [153]" please respect the author's rights."
17 [153]" press a key to continue.":[151]198,0:[146]198,1:[161]r$
20 [137]500:nd[178]0
100 [143] plot routine
110 [151]783,0:[151]781,vt:[151]782,ht
120 [158]65520
130 [142]
500 [143] main menu
510 [153]"load":[151]53281,0:[151]53280,5
520 [153]"2x2 loadstar statistics"
530 [153]"1> input data"
540 [153]"2> view your data"
550 [153]"3> view expected values"
560 [153]"4> chi-square test"
570 [153]"5> fisher's exact test"
580 [153]"6> mcnemar's test"
581 [153]"7> see examples"
582 [153]"8> exit"
590 :
600 [153]"make a selection ";:[151]198,0:[146]198,1:[161]r$
605 [139]r$[179]"1"[176]r$[177]"8"[167][153]:[153]"onononon";:[151]53280,[187](1)[172]15:[137]600
606 [139]r$[178]"7"[167][141]8541:[137]700:[143] save those values
607 [139]r$[178]"8"[167]20000
610 [145][197](r$)[141]7000,4500,8200,6000,4000,9500
620 [137]500
700 [143] example menu
701 [153]"load":[153]"examples menu"
702 [153]"1. example of chi-square test"
704 [153]"2. example of fisher's test"
706 [153]"3. example of mcnemar's test"
708 [153]"4. return to main menu"
710 :
720 [153]"make a selection":[151]198,0:[146]198,1:[161]r$
721 [139]r$[179]"1"[176]r$[177]"4"[167][153]"onononon";:[151]53280,[187](1)[172]15:[137]720
730 [139]r$[178]"1"[167]flag[178]1:[141]1920:[137]12000
734 [139]r$[178]"2"[167]flag[178]2:[141]1910:[137]12000
736 [139]r$[178]"3"[167]flag[178]3:[141]1930:[137]12000
760 [141]8651:[141]7400:[141]8000:[141]8500
761 [143] get values, margins, display values, save values
770 [137]500
900 :
1000 [143] compute factorial
1005 [139]n[178]1[176]n[178]0[167]s[178]1:[137]1050
1010 s[178]1
1020 [129]k[178]2[164]n
1030 s[178]k[172]s
1040 [130]
1050 [142]
1090 :
1900 [143] example
1910 b$[178]"fisher's exact example":x$(1)[178]"alive":x$(2)[178]"died"
1911 y$(1)[178]"gam glob":y$(2)[178]"pasteur":n(1,1)[178]11:n(1,2)[178]1:n(2,1)[178]2:n(2,2)[178]3
1912 [142]
1913 :
1920 b$[178]"chi-square example":x$(1)[178]"male":x$(2)[178]"female"
1921 y$(1)[178]"democrat":y$(2)[178]"republican":n(1,1)[178]15:n(1,2)[178]10:n(2,1)[178]7:n(2,2)[178]10
1922 [142]
1923 :
1930 b$[178]"mcnemar's test":x$(1)[178]"test2 +":x$(2)[178]"test2 -"
1931 y$(1)[178]"test1 +":y$(2)[178]"test1 -":n(1,1)[178]32:n(1,2)[178]10:n(2,1)[178]7:n(2,2)[178]26
1932 [142]
1933 :
1940 :
1999 [142]
2000 [143] draw 2 x 2 table
2005 [153]"load"b$
2006 d$[178]""
2010 [129]i[178]6[164]19:[153][202](d$,1,i)[166]10)"peek";[166]10)"peek"[166]10)"peek"
2020 [130]
2030 [129]x[178]1[164]3:[153]"":[129]p[178]1[164]4[172]x[170]2:[153]"";: [130]
2032 [153][166]9)"---------------------------"
2034 [130]
2040 [153]""y$(1)
2050 [153]""y$(2)
2060 [153]""x$(1)
2070 [153]""x$(2)
2080 [153]
2100 [142]
3000 vt[178]9:ht[178]14:[141]100
3002 [153]d(1,1);:ht[178]24:[141]100:[153]d(1,2);:ht[178]33:[141]100:[153]r(1)
3010 vt[178]13:ht[178]14:[141]100
3012 [153]d(2,1);:ht[178]24:[141]100:[153]d(2,2);:ht[178]33:[141]100:[153]r(2)
3020 vt[178]17:ht[178]14:[141]100
3022 [153]c(1);:ht[178]24:[141]100:[153]c(2);:ht[178]33:[141]100:[153]t
3090 [142]
3500 vt[178]9:ht[178]14:[141]100:[153]d(1,1):ht[178]24:[141]100:[153]""d(1,2)"wait";:ht[178]33:[141]100
3501 [153]r(1)
3510 vt[178]13:ht[178]14:[141]100:[153]""d(2,1)"wait":ht[178]24:[141]100:[153]d(2,2);:ht[178]33:[141]100
3511 [153]r(2)
3520 vt[178]17:ht[178]14:[141]100:[153]c(1);:ht[178]24:[141]100:[153]c(2):ht[178]33:[141]100:[153]t
3600 :
3999 [142]
4000 [143] fisher's exact test
4001 [139]t[178]0[167][141]15000:[137]4110
4002 prob[178]0:tag[178]0
4005 [139]t[177]33[167][153]"load cannot compute this function with the"
4006 [139]t[177]33[167][153]""[166]12)"current data.":[129]dl[178]1[164]3000:[130]:[137]4100
4010 [141]5100
4020 [141]5000
4030 prob[178]prob[170]x[173]p
4035 b$[178]"fisher's exact test"
4039 tag[178]0
4040 [139]n(li,lj)[178]0[167][141]2000:[141]3000:x[178]prob:tag[178]1
4042 [139]tag[178]1[167]vt[178]20:ht[178]0:[141]100:[153]" p=";:[141]11000:
4043 [139]tag[178]1[167][153]" press any key to continue":[151]198,0:[146]198,1
4044 [139]tag[178]1[167][161]r$:[153]:[137]4100
4050 [141]5200
4060 [137]4020
4100 [141]8600
4110 [142]
4200 :
4500 [143] view data
4501 [139]t[178]0[167][141]15000:[137]4540
4510 b$[178]"":[141]2000
4520 [141]3000
4530 [153]" press a key to continue":[151]198,0:[146]198,1:[161]r$
4540 [142]
4600 :
5000 [143] print fisher
5005 p[178]1
5010 [129]i[178]1[164]2:[129]j[178]1[164]2:n[178]n(i,j):[141]1000:p[178]p[172]s:[130]j,i
5020 [129]i[178]1[164]2
5030 n[178]c(i):[141]1000:cf(i)[178]s
5040 n[178]r(i):[141]1000:rf(i)[178]s
5050 [130]i
5060 n[178]t:[141]1000:tf[178]s
5070 x[178](cf(1)[172]cf(2)[173]tf)[172]rf(1)[172]rf(2)
5080 exact[178]x[173]p
5090 [142]
5095 :
5100 [143] set up fisher
5105 m[178]9999
5110 [139]m[177]r(1)[167] m[178]r(1):x[178]1
5120 [139]m[177]r(2)[167] m[178]r(2):x[178]2
5130 [139]m[177]c(1)[167] m[178]c(1):x[178]3
5140 [139]m[177]c(2)[167] m[178]c(2):x[178]4
5150 [139]x[179]3[167]a1[178]n(x,1)[173]c(1):a2[178]n(x,2)[173]c(2)
5160 [139]x[177]2[167]a1[178]n(1,x[171]2)[173]r(1):a2[178]n(2,x[171]2)[173]r(2)
5170 [139]x[179]3[167]li[178]x:lj[178]1:[139]a2[179]a1[167]lj[178]2
5180 [139]x[177]2[167]lj[178]x[171]2:li[178]1:[139]a2[179]a1[167]li[178]2
5190 [142]
5195 :
5200 [143] set up next pass fisher
5210 [129]i[178]1[164]2:[129]j[178]1[164]2
5230 [139]i[178]li[175]j[178]lj[167]n(i,j)[178]n(i,j)[171]1:[137]5290
5240 [139]i[179][177]li[175]j[179][177]lj[167]n(i,j)[178]n(i,j)[171]1:[137]5290
5250 n(i,j)[178]n(i,j)[170]1
5290 [130]j:[130]i
5300 [142]
5400 :
6000 [143] chi square and yates
6005 [139]t[178]0[167][141]15000:[137]6900
6006 b$[178]"chi-square test"
6010 cn[178]n(1,1)[172]n(2,2)[171]n(2,1)[172]n(1,2)
6020 yt[178][182](cn)[171]t[173]2
6030 prod[178]c(1)[172]c(2)[172]r(1)[172]r(2)
6040 csq[178]cn[174]2[172]t[173]prod
6050 yts[178]yt[174]2[172]t[173]prod
6060 [141]8000:[141]2000:[141]3000
6100 [153]"chi-square :"csq
6110 a[178]csq:[141]10000
6120 [153]a$
6125 [153]
6130 [153]"yates ="yts
6140 a[178]yts:[141]10000
6150 [153]a$
6160 [151]198,0:[146]198,1:[161]r$
6900 [153]:[142]
6999 :
7000 [143] input data
7010 x$(1)[178]" col 1":x$(2)[178]" col 2": y$(1)[178]" row 1":y$(2)[178]" row 2"
7020 [153]"load"
7025 [141]2000
7030 ht[178]10:vt[178]20:[141]100:[153]"do you want new labels"
7031 vt[178]21:ht[178]10:[141]100:[153]"for this table (y/n)";:
7032 [151]198,0:[146]198,1:[161]r$:[153]
7040 [139]r$[178]"y"[167][141]7300:[137]7020
7045 [139]r$[178]"n"[167]7200
7050 [153]"onononon";:[137]7032
7100 :
7200 [143] get data values
7201 nd[178]1:vt[178]1:ht[178]1:[141]100:[153]"put your data in the appropriate cell"
7220 vt[178]9:ht[178]14:[141]100:[133]n$:n(1,1)[178][197](n$)
7230 vt[178]9:ht[178]24:[141]100:[133]n$:n(1,2)[178][197](n$)
7240 vt[178]13:ht[178]14:[141]100:[133]n$:n(2,1)[178][197](n$)
7250 vt[178]13:ht[178]24:[141]100:[133]n$:n(2,2)[178][197](n$)
7260 vt[178]18:ht[178]10:[141]100:[153]"satisfied (y/n)";:[151]198,0:[146]198,1:[161]r$
7270 [139]n(1,1)[177]16[176]n(1,2)[177]16[176]n(2,1)[177]16[176]n(2,2)[177]16[167][141]16000:[137]7000
7272 [139]n(1,1)[179]0[176]n(1,2)[179]0[176]n(2,1)[179]0[176]n(2,2)[179]0[167][141]17000:[137]7000
7275 [141]7400:[141]8000:[141]8100
7288 [141]8500
7290 [142]
7295 :
7300 [143] input labels
7310 [153]"load"
7320 [133] "label for row 1 ";y$(1):[139][195](y$(1))[177]8[167]y$(1)[178][200](y$(1),8)
7330 [133] "label for row 2 ";y$(2):[139][195](y$(2))[177]8[167]y$(2)[178][200](y$(2),8)
7340 [133] "label for col 1 ";x$(1):[139][195](x$(1))[177]8[167]x$(1)[178][200](x$(1),8)
7350 [133] "label for col 2 ";x$(2):[139][195](x$(2))[177]8[167]x$(2)[178][200](x$(2),8)
7360 [142]
7390 :
7400 [143] calculate m