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