# source:project/wiki/eggref/4/statistics@20489

Last change on this file since 20489 was 20489, checked in by svnwiki, 10 years ago

Anonymous wiki edit for IP [86.129.203.107]:

File size: 5.4 KB
Line
1Still under testing!
2
3== Introduction
4
5This library is a port of [[http://compbio.uchsc.edu/Hunter_lab/Hunter/|Larry Hunter]]'s Lisp statistics library to chicken scheme.
6
7The library provides a number of formulae and methods taken from the book "Fundamentals of Biostatistics" by Bernard Rosner (5th edition).
8
9== Provided Functions
10
11=== Utilities
12
13*    average-rank
14*   beta-incomplete
15*    bin-and-count
16*   combinations
17*    factorial
18*    find-critical-value
19*    fisher-z-transform
20*    gamma-incomplete
21*    gamma-ln
22*    permutations
23*    random-normal
24
25; (random-pick items) : given a list of {{items}}, returns a random item.
26; (random-sample n items) : given a number of items to select, {{n}}, and a list of items to select from, {{items}}, returns a random sample without replacement of size {{n}}.
27; (sign n) : given a number {{n}}, returns 0, 1 or -1 according to if {{n}} is zero, positive or negative.
28; (square n) : given a number {{n}}, returns the square of {{n}}.
29
30=== Descriptive statistics
31
32These functions provide information on a given list of numbers.  Note, the list of items does not have to be sorted.
33
34; (mean items) : given a list of numbers, {{items}}, returns the arithmetic mean of the items (the sum of the numbers divided by the number of numbers).
35 (mean '(1 2 3 4 5)) => 3
36; (median items) : given a list of numbers, {{items}}, returns the value which separates the upper and lower halves of the list of numbers.
37 (median '(1 2 3 4)) => 5/2
38; (mode items) : given a list of numbers, {{items}}, returns two '''values'''.  The first is a list of the ''modes'' and the second is the frequency.  (A mode of a list of numbers is the most frequently occurring value.)
39 > (mode '(1 2 3 4))
40 (1 2 3 4)
41 1
42 > (mode '(1 2 2 3 4))
43 (2)
44 2
45 > (mode '(1 2 2 3 3 4))
46 (2 3)
47 2
48; (geometric-mean items) : given a list of numbers, {{items}}, returns the geometric mean of the items (the result of multiplying the items together and then taking the nth root, where n is the number of items).
49 (geometric-mean '(1 2 3 4 5)) => 2.60517108469735
50; (range items) : given a list of numbers, {{items}}, returns the difference between the biggest and the smallest value.
51 (range '(5 1 2 3 4)) => 4
52; (percentile items percent) : given a list of numbers, {{items}}, and a percentage, {{percent}}, returns the item closest to the percent value if the items are sorted into order; the returned item may be in the list, or the average of adjacent values.
53 (percentile '(1 2 3 4) 50) => 5/2
54 (percentile '(1 2 3 4) 67) => 3
55; (variance items) : given a list of numbers, {{items}}, returns the variance of the numbers.
56; (standard-deviation items) : given a list of numbers, {{items}}, returns the standard deviation of the numbers.
57; (coefficient-of-variation items) : given a list of numbers, {{items}}, returns 100 * (std-dev / mean) of the items.
58 (coefficient-of-variation '(1 2 3 4)) => 51.6397779494322
59; (standard-error-of-the-mean items) : given a list of numbers, {{items}}, returns std-dev / sqrt(length items).
60  (standard-error-of-the-mean '(1 2 3 4)) => 0.645497224367903
61; (mean-sd-n items) : given a list of numbers, {{items}}, returns three '''values''', one for the mean, one for the standard deviation, and one for the length of the list.
62 > (mean-sd-n '(1 2 3 4))
63 5/2
64 1.29099444873581
65 4
66
67=== Distributional functions
68
69*    binomial-probability
70*    binomial-cumulative-probability
71*    binomial-ge-probability
72*    binomial-le-probability
73*    poisson-probability
74*    poisson-cumulative-probability
75*    poisson-ge-probability
76*    normal-pdf
77*    convert-to-standard-normal
78*    phi
79*    z
80*    t-distribution
81*    chi-square
82*    chi-square-cdf
83
84===  Confidence intervals
85
86*    binomial-probability-ci
87*    poisson-mu-ci
88*    normal-mean-ci
89*    normal-mean-ci-on-sequence
90*    normal-variance-ci
91*    normal-variance-ci-on-sequence
92*    normal-sd-ci
93*    normal-sd-ci-on-sequence
94
95=== Hypothesis testing
96
97====  (parametric)
98
99*    z-test
100*    z-test-on-sequence
101*    t-test-one-sample
102*    t-test-one-sample-on-sequence
103*    t-test-paired
104*    t-test-paired-on-sequences
105*    t-test-two-sample
106*    t-test-two-sample-on-sequences
107*    f-test
108*    chi-square-test-one-sample
109*    binomial-test-one-sample
110*    binomial-test-two-sample
111*    fisher-exact-test
112*    mcnemars-test
113*    poisson-test-one-sample
114
115==== (non parametric)
116
117*    sign-test
118*    sign-test-on-sequence
119*    wilcoxon-signed-rank-test
120*    wilcoxon-signed-rank-test-on-sequences
121*    chi-square-test-rxc
122*    chi-square-test-for-trend
123
124=== Sample size estimates
125
126*    t-test-one-sample-sse
127*    t-test-two-sample-sse
128*    t-test-paired-sse
129*    binomial-test-one-sample-sse
130*    binomial-test-two-sample-sse
131*    binomial-test-paired-sse
132*    correlation-sse
133
134=== Correlation and regression
135
136*    linear-regression
137*    correlation-coefficient
138*    correlation-test-two-sample
139*    correlation-test-two-sample-on-sequences
140*    spearman-rank-correlation
141
142=== Significance test functions
143
144*    t-significance
145*    f-significance
146
147
148== Authors
149
150[[http://wiki.call-cc.org/users/peter-lane|Peter Lane]] wrote the scheme version of this library.  The original Lisp version was written by [[http://compbio.uhsc.edu/Hunter_lab/Hunter/|Larry Hunter]].
151