abanalyzer 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,559 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: ABAnalyzer::ABTest</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript"
13
- charset="utf-8"></script>
14
- <script src="../js/thickbox-compressed.js" type="text/javascript"
15
- charset="utf-8"></script>
16
- <script src="../js/quicksearch.js" type="text/javascript"
17
- charset="utf-8"></script>
18
- <script src="../js/darkfish.js" type="text/javascript"
19
- charset="utf-8"></script>
20
-
21
- </head>
22
- <body class="class">
23
-
24
- <div id="metadata">
25
- <div id="home-metadata">
26
- <div id="home-section" class="section">
27
- <h3 class="section-header">
28
- <a href="../index.html">Home</a>
29
- <a href="../index.html#classes">Classes</a>
30
- <a href="../index.html#methods">Methods</a>
31
- </h3>
32
- </div>
33
- </div>
34
-
35
- <div id="file-metadata">
36
- <div id="file-list-section" class="section">
37
- <h3 class="section-header">In Files</h3>
38
- <div class="section-body">
39
- <ul>
40
-
41
- <li><a href="../lib/abanalyzer/abtest_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
- class="thickbox" title="lib/abanalyzer/abtest.rb">lib/abanalyzer/abtest.rb</a></li>
43
-
44
- </ul>
45
- </div>
46
- </div>
47
-
48
-
49
- </div>
50
-
51
- <div id="class-metadata">
52
-
53
- <!-- Parent Class -->
54
-
55
- <div id="parent-class-section" class="section">
56
- <h3 class="section-header">Parent</h3>
57
-
58
- <p class="link">Object</p>
59
-
60
- </div>
61
-
62
-
63
- <!-- Namespace Contents -->
64
-
65
-
66
- <!-- Method Quickref -->
67
-
68
- <div id="method-list-section" class="section">
69
- <h3 class="section-header">Methods</h3>
70
- <ul class="link-list">
71
-
72
- <li><a href="#method-c-chi2dist">::chi2dist</a></li>
73
-
74
- <li><a href="#method-c-new">::new</a></li>
75
-
76
- <li><a href="#method-i-chisquare_p">#chisquare_p</a></li>
77
-
78
- <li><a href="#method-i-chisquare_score">#chisquare_score</a></li>
79
-
80
- <li><a href="#method-i-df">#df</a></li>
81
-
82
- <li><a href="#method-i-different%3F">#different?</a></li>
83
-
84
- <li><a href="#method-i-expected">#expected</a></li>
85
-
86
- <li><a href="#method-i-gtest_p">#gtest_p</a></li>
87
-
88
- <li><a href="#method-i-gtest_score">#gtest_score</a></li>
89
-
90
- <li><a href="#method-i-test_sufficient_data">#test_sufficient_data</a></li>
91
-
92
- </ul>
93
- </div>
94
-
95
-
96
- <!-- Included Modules -->
97
-
98
- </div>
99
-
100
- <div id="project-metadata">
101
-
102
-
103
- <div id="fileindex-section" class="section project-section">
104
- <h3 class="section-header">Files</h3>
105
- <ul>
106
-
107
- <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
108
-
109
- </ul>
110
- </div>
111
-
112
-
113
- <div id="classindex-section" class="section project-section">
114
- <h3 class="section-header">Class Index
115
- <span class="search-toggle"><img src="../images/find.png"
116
- height="16" width="16" alt="[+]"
117
- title="show/hide quicksearch" /></span></h3>
118
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
119
- <fieldset>
120
- <legend>Quicksearch</legend>
121
- <input type="text" name="quicksearch" value=""
122
- class="quicksearch-field" />
123
- </fieldset>
124
- </form>
125
-
126
- <ul class="link-list">
127
-
128
- <li><a href="../ABAnalyzer.html">ABAnalyzer</a></li>
129
-
130
- <li><a href="../ABAnalyzer/ABTest.html">ABAnalyzer::ABTest</a></li>
131
-
132
- <li><a href="../ABAnalyzer/InsufficientDataError.html">ABAnalyzer::InsufficientDataError</a></li>
133
-
134
- <li><a href="../ABAnalyzer/Matrix.html">ABAnalyzer::Matrix</a></li>
135
-
136
- <li><a href="../ABAnalyzer/MatrixFormatError.html">ABAnalyzer::MatrixFormatError</a></li>
137
-
138
- </ul>
139
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
140
- </div>
141
-
142
-
143
- </div>
144
- </div>
145
-
146
- <div id="documentation">
147
- <h1 class="class">ABAnalyzer::ABTest</h1>
148
-
149
- <div id="description">
150
-
151
- </div>
152
-
153
- <!-- Constants -->
154
-
155
-
156
- <!-- Attributes -->
157
-
158
-
159
- <!-- Methods -->
160
-
161
- <div id="public-class-method-details" class="method-section section">
162
- <h3 class="section-header">Public Class Methods</h3>
163
-
164
-
165
- <div id="new-method" class="method-detail ">
166
- <a name="method-c-new"></a>
167
-
168
- <div class="method-heading">
169
-
170
- <span class="method-name">new</span><span
171
- class="method-args">(values)</span>
172
- <span class="method-click-advice">click to toggle source</span>
173
-
174
- </div>
175
-
176
- <div class="method-description">
177
-
178
- <p>
179
- values should be hash of hashes, with top level hash the group names: {
180
- :groupa => { :yes => 20, :no => 10 }, :groupb => { :yes => 18, :no => 8 } }
181
- </p>
182
-
183
-
184
-
185
- <div class="method-source-code"
186
- id="new-source">
187
- <pre>
188
- <span class="ruby-comment cmt"># File lib/abanalyzer/abtest.rb, line 8</span>
189
- 8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">values</span>)
190
- 9: <span class="ruby-ivar">@values</span> = <span class="ruby-constant">Matrix</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">values</span>
191
- 10: <span class="ruby-keyword kw">end</span></pre>
192
- </div>
193
-
194
- </div>
195
-
196
-
197
-
198
-
199
- </div>
200
-
201
-
202
- </div>
203
-
204
- <div id="private-class-method-details" class="method-section section">
205
- <h3 class="section-header">Private Class Methods</h3>
206
-
207
-
208
- <div id="chi-dist-method" class="method-detail ">
209
- <a name="method-c-chi2dist"></a>
210
-
211
- <div class="method-heading">
212
-
213
- <span class="method-name">chi2dist</span><span
214
- class="method-args">(degrees, score)</span>
215
- <span class="method-click-advice">click to toggle source</span>
216
-
217
- </div>
218
-
219
- <div class="method-description">
220
-
221
-
222
-
223
-
224
-
225
- <div class="method-source-code"
226
- id="chi-dist-source">
227
- <pre>
228
- <span class="ruby-comment cmt"># File lib/abanalyzer/abtest.rb, line 58</span>
229
- 58: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">chi2dist</span>(<span class="ruby-identifier">degrees</span>, <span class="ruby-identifier">score</span>)
230
- 59: <span class="ruby-value">1</span> <span class="ruby-operator">-</span> <span class="ruby-constant">Statistics2</span>.<span class="ruby-identifier">chi2dist</span>(<span class="ruby-identifier">degrees</span>, <span class="ruby-identifier">score</span>)
231
- 60: <span class="ruby-keyword kw">end</span></pre>
232
- </div>
233
-
234
- </div>
235
-
236
-
237
-
238
-
239
- </div>
240
-
241
-
242
- </div>
243
-
244
- <div id="public-instance-method-details" class="method-section section">
245
- <h3 class="section-header">Public Instance Methods</h3>
246
-
247
-
248
- <div id="chisquare-p-method" class="method-detail ">
249
- <a name="method-i-chisquare_p"></a>
250
-
251
- <div class="method-heading">
252
-
253
- <span class="method-name">chisquare_p</span><span
254
- class="method-args">()</span>
255
- <span class="method-click-advice">click to toggle source</span>
256
-
257
- </div>
258
-
259
- <div class="method-description">
260
-
261
-
262
-
263
-
264
-
265
- <div class="method-source-code"
266
- id="chisquare-p-source">
267
- <pre>
268
- <span class="ruby-comment cmt"># File lib/abanalyzer/abtest.rb, line 36</span>
269
- 36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chisquare_p</span>
270
- 37: <span class="ruby-constant">ABTest</span>.<span class="ruby-identifier">chi2dist</span>(<span class="ruby-identifier">df</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">chisquare_score</span>)
271
- 38: <span class="ruby-keyword kw">end</span></pre>
272
- </div>
273
-
274
- </div>
275
-
276
-
277
-
278
-
279
- </div>
280
-
281
-
282
- <div id="chisquare-score-method" class="method-detail ">
283
- <a name="method-i-chisquare_score"></a>
284
-
285
- <div class="method-heading">
286
-
287
- <span class="method-name">chisquare_score</span><span
288
- class="method-args">()</span>
289
- <span class="method-click-advice">click to toggle source</span>
290
-
291
- </div>
292
-
293
- <div class="method-description">
294
-
295
-
296
-
297
-
298
-
299
- <div class="method-source-code"
300
- id="chisquare-score-source">
301
- <pre>
302
- <span class="ruby-comment cmt"># File lib/abanalyzer/abtest.rb, line 16</span>
303
- 16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chisquare_score</span>
304
- 17: <span class="ruby-identifier">sum</span>=<span class="ruby-value">0</span>
305
- 18: <span class="ruby-ivar">@values</span>.<span class="ruby-identifier">each_cell</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">colname</span>, <span class="ruby-identifier">rowname</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
306
- 19: <span class="ruby-identifier">ex</span> = <span class="ruby-identifier">expected</span>(<span class="ruby-identifier">colname</span>, <span class="ruby-identifier">rowname</span>)
307
- 20: <span class="ruby-identifier">test_sufficient_data</span>(<span class="ruby-identifier">colname</span>, <span class="ruby-identifier">rowname</span>, <span class="ruby-identifier">ex</span>, <span class="ruby-identifier">value</span>)
308
- 21: <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> ((<span class="ruby-identifier">value</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">ex</span>) <span class="ruby-operator">**</span> <span class="ruby-value">2</span>) <span class="ruby-operator">/</span> <span class="ruby-identifier">ex</span>
309
- 22: }
310
- 23: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sum</span>
311
- 24: <span class="ruby-keyword kw">end</span></pre>
312
- </div>
313
-
314
- </div>
315
-
316
-
317
-
318
-
319
- </div>
320
-
321
-
322
- <div id="different--method" class="method-detail ">
323
- <a name="method-i-different%3F"></a>
324
-
325
- <div class="method-heading">
326
-
327
- <span class="method-name">different?</span><span
328
- class="method-args">(sig=0.05)</span>
329
- <span class="method-click-advice">click to toggle source</span>
330
-
331
- </div>
332
-
333
- <div class="method-description">
334
-
335
-
336
-
337
-
338
-
339
- <div class="method-source-code"
340
- id="different--source">
341
- <pre>
342
- <span class="ruby-comment cmt"># File lib/abanalyzer/abtest.rb, line 12</span>
343
- 12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">different?</span>(<span class="ruby-identifier">sig</span>=<span class="ruby-value">0.05</span>)
344
- 13: <span class="ruby-identifier">gtest_p</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">sig</span>
345
- 14: <span class="ruby-keyword kw">end</span></pre>
346
- </div>
347
-
348
- </div>
349
-
350
-
351
-
352
-
353
- </div>
354
-
355
-
356
- <div id="gtest-p-method" class="method-detail ">
357
- <a name="method-i-gtest_p"></a>
358
-
359
- <div class="method-heading">
360
-
361
- <span class="method-name">gtest_p</span><span
362
- class="method-args">()</span>
363
- <span class="method-click-advice">click to toggle source</span>
364
-
365
- </div>
366
-
367
- <div class="method-description">
368
-
369
-
370
-
371
-
372
-
373
- <div class="method-source-code"
374
- id="gtest-p-source">
375
- <pre>
376
- <span class="ruby-comment cmt"># File lib/abanalyzer/abtest.rb, line 40</span>
377
- 40: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gtest_p</span>
378
- 41: <span class="ruby-constant">ABTest</span>.<span class="ruby-identifier">chi2dist</span>(<span class="ruby-identifier">df</span>, <span class="ruby-value">2</span>*<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gtest_score</span>)
379
- 42: <span class="ruby-keyword kw">end</span></pre>
380
- </div>
381
-
382
- </div>
383
-
384
-
385
-
386
-
387
- </div>
388
-
389
-
390
- <div id="gtest-score-method" class="method-detail ">
391
- <a name="method-i-gtest_score"></a>
392
-
393
- <div class="method-heading">
394
-
395
- <span class="method-name">gtest_score</span><span
396
- class="method-args">()</span>
397
- <span class="method-click-advice">click to toggle source</span>
398
-
399
- </div>
400
-
401
- <div class="method-description">
402
-
403
-
404
-
405
-
406
-
407
- <div class="method-source-code"
408
- id="gtest-score-source">
409
- <pre>
410
- <span class="ruby-comment cmt"># File lib/abanalyzer/abtest.rb, line 26</span>
411
- 26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gtest_score</span>
412
- 27: <span class="ruby-identifier">sum</span>=<span class="ruby-value">0</span>
413
- 28: <span class="ruby-ivar">@values</span>.<span class="ruby-identifier">each_cell</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">colname</span>, <span class="ruby-identifier">rowname</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
414
- 29: <span class="ruby-identifier">ex</span> = <span class="ruby-identifier">expected</span>(<span class="ruby-identifier">colname</span>, <span class="ruby-identifier">rowname</span>)
415
- 30: <span class="ruby-identifier">test_sufficient_data</span>(<span class="ruby-identifier">colname</span>, <span class="ruby-identifier">rowname</span>, <span class="ruby-identifier">ex</span>, <span class="ruby-identifier">value</span>)
416
- 31: <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">value</span> * <span class="ruby-constant">Math</span>.<span class="ruby-identifier">log</span>(<span class="ruby-identifier">value</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">ex</span>)
417
- 32: }
418
- 33: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sum</span>
419
- 34: <span class="ruby-keyword kw">end</span></pre>
420
- </div>
421
-
422
- </div>
423
-
424
-
425
-
426
-
427
- </div>
428
-
429
-
430
- </div>
431
-
432
- <div id="private-instance-method-details" class="method-section section">
433
- <h3 class="section-header">Private Instance Methods</h3>
434
-
435
-
436
- <div id="df-method" class="method-detail ">
437
- <a name="method-i-df"></a>
438
-
439
- <div class="method-heading">
440
-
441
- <span class="method-name">df</span><span
442
- class="method-args">()</span>
443
- <span class="method-click-advice">click to toggle source</span>
444
-
445
- </div>
446
-
447
- <div class="method-description">
448
-
449
-
450
-
451
-
452
-
453
- <div class="method-source-code"
454
- id="df-source">
455
- <pre>
456
- <span class="ruby-comment cmt"># File lib/abanalyzer/abtest.rb, line 54</span>
457
- 54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">df</span>
458
- 55: (<span class="ruby-ivar">@values</span>.<span class="ruby-identifier">columns</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) * (<span class="ruby-ivar">@values</span>.<span class="ruby-identifier">rows</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
459
- 56: <span class="ruby-keyword kw">end</span></pre>
460
- </div>
461
-
462
- </div>
463
-
464
-
465
-
466
-
467
- </div>
468
-
469
-
470
- <div id="expected-method" class="method-detail ">
471
- <a name="method-i-expected"></a>
472
-
473
- <div class="method-heading">
474
-
475
- <span class="method-name">expected</span><span
476
- class="method-args">(colname, rowname)</span>
477
- <span class="method-click-advice">click to toggle source</span>
478
-
479
- </div>
480
-
481
- <div class="method-description">
482
-
483
-
484
-
485
-
486
-
487
- <div class="method-source-code"
488
- id="expected-source">
489
- <pre>
490
- <span class="ruby-comment cmt"># File lib/abanalyzer/abtest.rb, line 50</span>
491
- 50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expected</span>(<span class="ruby-identifier">colname</span>, <span class="ruby-identifier">rowname</span>)
492
- 51: (<span class="ruby-ivar">@values</span>.<span class="ruby-identifier">row_sum</span>(<span class="ruby-identifier">rowname</span>) * <span class="ruby-ivar">@values</span>.<span class="ruby-identifier">column_sum</span>(<span class="ruby-identifier">colname</span>)).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-ivar">@values</span>.<span class="ruby-identifier">total_sum</span>.<span class="ruby-identifier">to_f</span>
493
- 52: <span class="ruby-keyword kw">end</span></pre>
494
- </div>
495
-
496
- </div>
497
-
498
-
499
-
500
-
501
- </div>
502
-
503
-
504
- <div id="test-sufficient-data-method" class="method-detail ">
505
- <a name="method-i-test_sufficient_data"></a>
506
-
507
- <div class="method-heading">
508
-
509
- <span class="method-name">test_sufficient_data</span><span
510
- class="method-args">(colname, rowname, expected, value)</span>
511
- <span class="method-click-advice">click to toggle source</span>
512
-
513
- </div>
514
-
515
- <div class="method-description">
516
-
517
-
518
-
519
-
520
-
521
- <div class="method-source-code"
522
- id="test-sufficient-data-source">
523
- <pre>
524
- <span class="ruby-comment cmt"># File lib/abanalyzer/abtest.rb, line 45</span>
525
- 45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_sufficient_data</span>(<span class="ruby-identifier">colname</span>, <span class="ruby-identifier">rowname</span>, <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">value</span>)
526
- 46: <span class="ruby-identifier">msg</span> = <span class="ruby-node">&quot;Insufficient data size for column #{colname} row #{rowname}. Expected value must be &gt;= 5, and value must be &gt; 0.&quot;</span>
527
- 47: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InsufficientDataError</span>, <span class="ruby-identifier">msg</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">expected</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">5</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">0</span>
528
- 48: <span class="ruby-keyword kw">end</span></pre>
529
- </div>
530
-
531
- </div>
532
-
533
-
534
-
535
-
536
- </div>
537
-
538
-
539
- </div>
540
-
541
-
542
- </div>
543
-
544
-
545
- <div id="rdoc-debugging-section-dump" class="debugging-section">
546
-
547
- <p>Disabled; run with --debug to generate this.</p>
548
-
549
- </div>
550
-
551
- <div id="validator-badges">
552
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
553
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
554
- Rdoc Generator</a> 1.1.6</small>.</p>
555
- </div>
556
-
557
- </body>
558
- </html>
559
-