-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathqa-statdist
executable file
·88 lines (74 loc) · 2.49 KB
/
qa-statdist
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
81
82
83
84
85
86
87
#!/usr/bin/env newlisp
(define (test-prob-t)
(and
(< (abs (sub (prob-t 1.886 2) 0.1)) 0.001)
(< (abs (sub (prob-t 1.303 40) 0.1)) 0.001)
(< (abs (sub (prob-t 6.965 2) 0.01)) 0.0001)
(< (abs (sub (prob-t 2.423 40) 0.01)) 0.0001)
))
(define (test-crit-t)
(and
(< (abs (sub (crit-t (prob-t 1.886 2) 2) 1.886)) 0.001)
(< (abs (sub (crit-t (prob-t 1.303 40) 40) 1.303)) 0.001)
(< (abs (sub (crit-t (prob-t 6.965 2) 2) 6.965)) 0.001)
(< (abs (sub (crit-t (prob-t 2.423 40) 40) 2.423)) 0.001)
))
(define (test-prob-f)
(and
(< (abs (sub (prob-f 6.59 3 4) 0.05)) 0.001)
(< (abs (sub (prob-f 2.79 12 11) 0.05)) 0.001)
(< (abs (sub (prob-f 16.69 3 4) 0.01)) 0.0001)
(< (abs (sub (prob-f 4.40 12 11) 0.01)) 0.0001)
))
(define (test-crit-f)
(and
(< (abs (sub (crit-f (prob-f 6.59 3 4) 3 4) 6.59)) 0.001)
(< (abs (sub (crit-f (prob-f 2.79 12 11) 12 11) 2.79)) 0.001)
(< (abs (sub (crit-f (prob-f 16.59 3 4) 3 4) 16.59)) 0.001)
(< (abs (sub (crit-f (prob-f 4.40 12 11) 12 11) 4.40)) 0.001)
))
(define (test-prob-chi2)
(and
(< (abs (sub (prob-chi2 4.605 2) 0.1)) 0.001)
(< (abs (sub (prob-chi2 51.805 40) 0.1)) 0.001)
(< (abs (sub (prob-chi2 9.210 2) 0.01)) 0.0001)
(< (abs (sub (prob-chi2 63.691 40) 0.01)) 0.0001)
))
(define (test-crit-chi2)
(and
(< (abs (sub (crit-chi2 (prob-chi2 4.605 2) 2) 4.605)) 0.001)
(< (abs (sub (crit-chi2 (prob-chi2 51.805 40) 40) 51.805)) 0.001)
(< (abs (sub (crit-chi2 (prob-chi2 9.210 2) 2) 9.210)) 0.001)
(< (abs (sub (crit-chi2 (prob-chi2 63.691 40) 40) 63.691)) 0.001)
))
(define (test-crit-z)
(for (z -6 6 0.3)
(let (flag true)
(if (> (abs (sub (crit-z (prob-z z)) z)) 0.0001)
(set 'flag nil))
flag)
))
(define (test-prob-z)
(and
(< (sub (prob-z -0.1) 0.4601721627) 0.00001)
(< (sub (prob-z 0.1) 0.5398278373) 0.00001)
(< (sub (prob-z -1) 0.1586552539) 0.00001)
(< (sub (prob-z 1) 0.8413447461) 0.00001)
(< (sub (prob-z -2) 0.02275013195) 0.00001)
(< (sub (prob-z 2) 0.9772498681) 0.00001)
(< (sub (prob-z -3) 0.001349898032) 0.00001)
(< (sub (prob-z 3) 0.998650102) 0.00001)
))
(if (not (and
(test-prob-f)
(test-crit-f)
(test-prob-chi2)
(test-crit-chi2)
(test-prob-t)
(test-crit-t)
(test-prob-z)
(test-crit-z)))
(println ">>>>> PROBLEM in statistical distributions tests")
(println ">>>>> Statisitical distribution tests SUCCESSFUL")
)
(exit)