UNPKG

6.83 kBMarkdownView Raw
1## Statistical Tests
2
3The test module includes methods that enact popular statistical tests.
4The tests that are implemented are Z tests, T tests, and F tests.
5Also included are methods for developing confidence intervals. Currently
6regression is not included but it should be included soon (once matrix
7inversion is fixed).
8
9## Statistics Instance Functionality
10
11### zscore( value[, flag] )
12
13Returns the z-score of `value` taking the jStat object as the observed
14values. `flag===true` denotes use of sample standard deviation.
15
16### ztest( value, sides[, flag] )
17
18Returns the p-value of `value` taking the jStat object as the observed
19values. `sides` is an integer value 1 or 2 denoting a 1 or 2 sided z-test.
20The test defaults to a 2 sided z-test if `sides` is not specified. `flag===true`
21denotes use of sample standard deviation.
22
23### tscore( value )
24
25Returns the t-score of `value` taking the jStat object as the observed
26values.
27
28### ttest( value, sides )
29
30Returns the p-value of `value` taking the jStat object as the observed
31values. `sides` is an integer value 1 or 2 denoting a 1 or 2 sided t-test.
32The test defaults to a 2 sided t-test if `sides` is not specified.
33
34### anovafscore()
35
36Returns the f-score of the ANOVA test on the arrays of the jStat object.
37
38### anovaftest()
39
40Returns the p-value of an ANOVA test on the arrays of the jStat object.
41
42## Static Methods
43
44## Z Statistics
45
46### jStat.zscore( value, mean, sd )
47
48Returns the z-score of `value` given the `mean` mean and the `sd` standard deviation
49of the test.
50
51### jStat.zscore( value, array[, flag] )
52
53Returns the z-score of `value` given the data from `array`. `flag===true` denotes
54use of the sample standard deviation.
55
56### jStat.ztest( value, mean, sd, sides )
57
58Returns the p-value of a the z-test of `value` given the `mean` mean and `sd` standard
59deviation of the test. `sides` is an integer value 1 or 2 denoting a
60one or two sided z-test. If `sides` is not specified the test defaults
61to a two sided z-test.
62
63### jStat.ztest( zscore, sides )
64
65Returns the p-value of the `zscore` z-score. `sides` is an integer value 1 or 2
66denoting a one or two sided z-test. If `sides` is not specified the test
67defaults to a two sided z-test
68
69### jStat.ztest( value, array, sides[, flag] )
70
71Returns the p-value of `value` given the data from `array`. `sides` is
72an integer value 1 or 2 denoting a one or two sided z-test. If `sides`
73is not specified the test defaults to a two sided z-test. `flag===true`
74denotes the use of the sample standard deviation.
75
76## T Statistics
77
78### jStat.tscore( value, mean, sd, n )
79
80Returns the t-score of `value` given the `mean` mean, `sd` standard deviation,
81and the sample size `n`.
82
83### jStat.tscore( value, array )
84
85Returns the t-score of `value` given the data from `array`.
86
87### jStat.ttest( value, mean, sd, n, sides )
88
89Returns the p-value of `value` given the `mean` mean, `sd` standard deviation,
90and the sample size `n`. `sides` is an integer value 1 or 2 denoting
91a one or two sided t-test. If `sides` is not specified the test
92defaults to a two sided t-test.
93
94### jStat.ttest( tscore, n, sides )
95
96Returns the p-value of the `tscore` t-score given the sample size `n`. `sides`
97is an integer value 1 or 2 denoting a one or two sided t-test.
98If `sides` is not specified the test defaults to a two sided t-test.
99
100### jStat.ttest( value, array, sides )
101
102Returns the p-value of `value` given the data in `array`.
103`sides` is an integer value 1 or 2 denoting a one or two sided
104t-test. If `sides` is not specified the test defaults to a two
105sided t-test.
106
107## F Statistics
108
109### jStat.anovafscore( array1, array2, ..., arrayn )
110
111Returns the f-score of an ANOVA on the arrays.
112
113### jStat.anovafscore( [array1,array2, ...,arrayn] )
114
115Returns the f-score of an ANOVA on the arrays.
116
117### jStat.anovaftest( array1, array2, ...., arrayn )
118
119Returns the p-value of the f-statistic from the ANOVA
120test on the arrays.
121
122### jStat.ftest( fscore, df1, df2)
123
124Returns the p-value for the `fscore` f-score with a `df1` numerator degrees
125of freedom and a `df2` denominator degrees of freedom.
126
127## Tukey's Range Test
128
129### jStat.qscore( mean1, mean2, n1, n2, sd )
130
131Returns the q-score of a single pairwise comparison between arrays
132of mean `mean1` and `mean2`, size `n1` and `n2`, and standard deviation (of
133all vectors) `sd`.
134
135### jStat.qscore( array1, array2, sd )
136
137Same as above, but the means and sizes are calculated automatically
138from the arrays.
139
140### jStat.qtest( qscore, n, k )
141
142Returns the p-value of the q-score given the total sample size `n`
143and `k` number of populations.
144
145### jStat.qtest( mean1, mean2, n1, n2, sd, n, k )
146
147Returns the p-value of a single pairwise comparison between arrays
148of mean `mean1` and `mean2`, size `n1` and `n2`, and standard deviation (of
149all vectors) `sd`, where the total sample size is `n` and the number of
150populations is `k`.
151
152### jStat.qtest( array1, array2, sd, n, k )
153
154Same as above, but the means and sizes are calculated automatically
155from the arrays.
156
157### jStat.tukeyhsd( arrays )
158
159Performs the full Tukey's range test returning p-values for every
160pairwise combination of the arrays in the format of
161`[[[index1, index2], pvalue], ...]`
162
163For example:
164
165 > jStat.tukeyhsd([[1, 2], [3, 4, 5], [6], [7, 8]])
166 [ [ [ 0, 1 ], 0.10745283896120883 ],
167 [ [ 0, 2 ], 0.04374051946838586 ],
168 [ [ 0, 3 ], 0.007850804224287633 ],
169 [ [ 1, 2 ], 0.32191548545694226 ],
170 [ [ 1, 3 ], 0.03802747415485819 ],
171 [ [ 2, 3 ], 0.5528665999257486 ] ]
172
173## Confidence Intervals
174
175### jStat.normalci( value, alpha, sd, n )
176
177Returns a 1-alpha confidence interval for `value` given
178a normal distribution with a standard deviation `sd` and a
179sample size `n`
180
181### jStat.normalci( value, alpha, array )
182
183Returns a 1-alpha confidence interval for `value` given
184a normal distribution in the data from `array`.
185
186### jStat.tci( value, alpha, sd, n )
187
188Returns a 1-alpha confidence interval for `value` given
189the standard deviation `sd` and the sample size `n`.
190
191### jStat.tci( value, alpha, array )
192
193Returns a 1-alpha confidence interval for `value` given
194the data from `array`.
195
196### jStat.oneSidedDifferenceOfProportions( p1, n1, p2, n2 )
197
198Returns the p-value for a 1-sided test for the difference
199between two proportions. `p1` is the sample proportion for
200the first sample, whereas `p2` is the sample proportion for
201the second sample. Similiarly, `n1` is the sample size of the
202first sample and `n2` is the sample size for the second sample.
203
204### jStat.twoSidedDifferenceOfProportions( p1, n1, p2, n2 )
205
206Returns the p-value for a 2-sided test for the difference
207between two proportions. `p1` is the sample proportion for
208the first sample, whereas `p2` is the sample proportion for
209the second sample. Similiarly, `n1` is the sample size of the
210first sample and `n2` is the sample size for the second sample.