-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathABT2.pas
80 lines (80 loc) · 1.3 KB
/
ABT2.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//ABT2(cell count a,b,c,d)/D.G.SCHRAUSSER/2025
//2×2 chi-squared test for independence
//Observed frequencies abcd fb
//Expected frequencies fe
//Probabilities p(A^B), p(B|A), p(A|B)
//Chi-squared with 2-tailed p
//e.g.ABT2(17,12,14,24)[Spreadsheet]
#cas
ABT2(a,b,c,d):=
BEGIN
STARTAPP("Arbeitsblatt");
STARTVIEW(1)
"A1"▶B1
"A2"▶C1
"A1"▶E1
"A2"▶F1
"B1"▶A2
"B2"▶A3
"B1"▶A5
"B2"▶A6
"B1"▶A8
"B2"▶A9
"B1"▶A11
"B2"▶A12
a▶B2
b▶C2
c▶B3
d▶C3
D2:==B2+C2
D3:==B3+C3
B4:==B2+B3
C4:==C2+C3
D4:==B2+C2+B3+C3
E5:==B2/D4
F5:==C2/D4
g5:==D2/D4
E6:==B3/D4
F6:==C3/D4
g6:==D3/D4
E7:==B4/D4
F7:==C4/D4
g7:==g5+g6
E2:==B2/D2
F2:==C2/D2
g2:==E2+F2
E3:==B3/D3
F3:==C3/D3
g3:==E3+F3
B5:==B2/B4
B6:==B3/B4
B7:==B5+B6
C5:==C2/C4
C6:==C3/C4
C7:==C5+C6
B8:==E7*D2
B9:==E7*D3
C8:==F7*D2
C9:==F7*D3
D13:==D4*(B2*C3-C2*B3)^2/((B2+C2)*(B3+C3)*(B2+B3)*(C2+C3))
B11:==(B2-B8)^2/B8
B12:==(B3-B9)^2/B9
C11:==(C2-C8)^2/C8
C12:==(C3-C9)^2/C9
D11:==((B2-B8)^2/B8)+(C2-C8)^2/C8
D12:==((B3-B9)^2/B9)+(C3-C9)^2/C9
B13:==B11+B12
C13:==C11+C12
g11:==1-(CHISQUARE_CDF(1,D11))
g12:==1-(CHISQUARE_CDF(1,D12))
g13:==1-(CHISQUARE_CDF(1,D13))
E11:==1-(CHISQUARE_CDF(1,B11))
E12:==1-(CHISQUARE_CDF(1,B12))
E13:==1-(CHISQUARE_CDF(1,B13))
F11:==1-(CHISQUARE_CDF(1,C11))
F12:==1-(CHISQUARE_CDF(1,C12))
F13:==1-(CHISQUARE_CDF(1,C13))
1
END;
#end
//