statsample 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. data/.gemtest +0 -0
  2. data/History.txt +14 -0
  3. data/Manifest.txt +4 -0
  4. data/README.txt +49 -13
  5. data/data/locale/es/LC_MESSAGES/statsample.mo +0 -0
  6. data/lib/statsample.rb +1 -23
  7. data/lib/statsample/analysis.rb +49 -28
  8. data/lib/statsample/analysis/suite.rb +18 -5
  9. data/lib/statsample/analysis/suitereportbuilder.rb +9 -3
  10. data/lib/statsample/anova.rb +2 -0
  11. data/lib/statsample/anova/contrast.rb +79 -0
  12. data/lib/statsample/anova/oneway.rb +39 -5
  13. data/lib/statsample/converter/csv.rb +2 -5
  14. data/lib/statsample/converters.rb +1 -0
  15. data/lib/statsample/dataset.rb +31 -1
  16. data/lib/statsample/graph/histogram.rb +1 -1
  17. data/lib/statsample/regression/multiple/baseengine.rb +5 -0
  18. data/lib/statsample/reliability/multiscaleanalysis.rb +3 -1
  19. data/lib/statsample/reliability/scaleanalysis.rb +3 -4
  20. data/lib/statsample/shorthand.rb +41 -1
  21. data/lib/statsample/test.rb +10 -0
  22. data/lib/statsample/test/kolmogorovsmirnov.rb +61 -0
  23. data/lib/statsample/test/t.rb +92 -9
  24. data/lib/statsample/vector.rb +143 -10
  25. data/po/es/statsample.mo +0 -0
  26. data/po/es/statsample.po +109 -110
  27. data/po/statsample.pot +108 -60
  28. data/test/helpers_tests.rb +1 -0
  29. data/test/test_analysis.rb +70 -11
  30. data/test/test_anova_contrast.rb +36 -0
  31. data/test/test_anovawithvectors.rb +8 -0
  32. data/test/test_dataset.rb +12 -0
  33. data/test/test_factor_pa.rb +1 -3
  34. data/test/test_test_kolmogorovsmirnov.rb +34 -0
  35. data/test/test_test_t.rb +16 -0
  36. data/test/test_vector.rb +40 -2
  37. metadata +44 -118
  38. data.tar.gz.sig +0 -0
  39. metadata.gz.sig +0 -0
data/po/statsample.pot CHANGED
@@ -6,8 +6,8 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: statsample 1.0.0\n"
10
- "POT-Creation-Date: 2011-01-28 18:40-0300\n"
9
+ "Project-Id-Version: statsample 1.0.1\n"
10
+ "POT-Creation-Date: 2011-03-03 12:03-0300\n"
11
11
  "PO-Revision-Date: 2009-08-04 15:36-0400\n"
12
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -20,46 +20,78 @@ msgstr ""
20
20
  msgid "F Test"
21
21
  msgstr ""
22
22
 
23
- #: lib/statsample/test/t.rb:209
23
+ #: lib/statsample/test/t.rb:82
24
+ msgid "T Test"
25
+ msgstr ""
26
+
27
+ #: lib/statsample/test/t.rb:83
28
+ msgid "Estimate"
29
+ msgstr ""
30
+
31
+ #: lib/statsample/test/t.rb:84
32
+ msgid "Std.Err.of Estimate"
33
+ msgstr ""
34
+
35
+ #: lib/statsample/test/t.rb:114
36
+ msgid "%s: %0.4f | %s: %0.4f"
37
+ msgstr ""
38
+
39
+ #: lib/statsample/test/t.rb:120
40
+ msgid "t(%d) = %0.4f, p=%0.4f (%s tails)"
41
+ msgstr ""
42
+
43
+ #: lib/statsample/test/t.rb:121
44
+ msgid "CI(%d%%): %0.4f - %0.4f"
45
+ msgstr ""
46
+
47
+ #: lib/statsample/test/t.rb:190
48
+ msgid "Sample mean: %0.4f | Sample sd: %0.4f | se : %0.4f"
49
+ msgstr ""
50
+
51
+ #: lib/statsample/test/t.rb:191
52
+ msgid "Population mean: %0.4f"
53
+ msgstr ""
54
+
55
+ #: lib/statsample/test/t.rb:292
24
56
  msgid "Mean and standard deviation"
25
57
  msgstr ""
26
58
 
27
- #: lib/statsample/test/t.rb:209 lib/statsample/regression/simple.rb:109
59
+ #: lib/statsample/test/t.rb:292 lib/statsample/regression/simple.rb:109
28
60
  #: lib/statsample/factor/pca.rb:216 lib/statsample/factor/principalaxis.rb:202
29
61
  msgid "Variable"
30
62
  msgstr ""
31
63
 
32
- #: lib/statsample/test/t.rb:209
64
+ #: lib/statsample/test/t.rb:292
33
65
  #: lib/statsample/dominanceanalysis/bootstrap.rb:208
34
66
  msgid "mean"
35
67
  msgstr ""
36
68
 
37
- #: lib/statsample/test/t.rb:209
69
+ #: lib/statsample/test/t.rb:292
38
70
  msgid "sd"
39
71
  msgstr ""
40
72
 
41
- #: lib/statsample/test/t.rb:209 lib/statsample/factor/parallelanalysis.rb:103
73
+ #: lib/statsample/test/t.rb:292 lib/statsample/factor/parallelanalysis.rb:103
42
74
  #: lib/statsample/factor/parallelanalysis.rb:111
43
75
  msgid "n"
44
76
  msgstr ""
45
77
 
46
- #: lib/statsample/test/t.rb:213
78
+ #: lib/statsample/test/t.rb:296
47
79
  msgid "Levene test for equality of variances"
48
80
  msgstr ""
49
81
 
50
- #: lib/statsample/test/t.rb:215
82
+ #: lib/statsample/test/t.rb:298
51
83
  msgid "T statistics"
52
84
  msgstr ""
53
85
 
54
- #: lib/statsample/test/t.rb:216
86
+ #: lib/statsample/test/t.rb:299
55
87
  msgid "Equal variance"
56
88
  msgstr ""
57
89
 
58
- #: lib/statsample/test/t.rb:217
90
+ #: lib/statsample/test/t.rb:300
59
91
  msgid "Non equal variance"
60
92
  msgstr ""
61
93
 
62
- #: lib/statsample/test/t.rb:219
94
+ #: lib/statsample/test/t.rb:302
63
95
  msgid "Effect size"
64
96
  msgstr ""
65
97
 
@@ -268,7 +300,7 @@ msgstr ""
268
300
  msgid "Anova Two-Way on %s"
269
301
  msgstr ""
270
302
 
271
- #: lib/statsample/anova/twoway.rb:184 lib/statsample/anova/oneway.rb:101
303
+ #: lib/statsample/anova/twoway.rb:184 lib/statsample/anova/oneway.rb:127
272
304
  msgid "Test of Homogeneity of variances (Levene)"
273
305
  msgstr ""
274
306
 
@@ -284,22 +316,38 @@ msgstr ""
284
316
  msgid "Unexplained variance"
285
317
  msgstr ""
286
318
 
287
- #: lib/statsample/anova/oneway.rb:91
319
+ #: lib/statsample/anova/oneway.rb:97
288
320
  msgid "Anova One-Way"
289
321
  msgstr ""
290
322
 
291
- #: lib/statsample/anova/oneway.rb:92
323
+ #: lib/statsample/anova/oneway.rb:98
292
324
  msgid "Between Groups"
293
325
  msgstr ""
294
326
 
295
- #: lib/statsample/anova/oneway.rb:93
327
+ #: lib/statsample/anova/oneway.rb:99
296
328
  msgid "Within Groups"
297
329
  msgstr ""
298
330
 
299
- #: lib/statsample/anova/oneway.rb:137
331
+ #: lib/statsample/anova/oneway.rb:119
332
+ msgid "Contrast for %s"
333
+ msgstr ""
334
+
335
+ #: lib/statsample/anova/oneway.rb:163
300
336
  msgid "Descriptives"
301
337
  msgstr ""
302
338
 
339
+ #: lib/statsample/anova/contrast.rb:13
340
+ msgid "Psi estimate"
341
+ msgstr ""
342
+
343
+ #: lib/statsample/anova/contrast.rb:14
344
+ msgid "Contrast"
345
+ msgstr ""
346
+
347
+ #: lib/statsample/anova/contrast.rb:73
348
+ msgid "Contrast:%s"
349
+ msgstr ""
350
+
303
351
  #: lib/statsample/graph/scatterplot.rb:72
304
352
  msgid "Scatterplot (%s - %s)"
305
353
  msgstr ""
@@ -529,27 +577,27 @@ msgstr ""
529
577
  msgid "Scale %s"
530
578
  msgstr ""
531
579
 
532
- #: lib/statsample/reliability/multiscaleanalysis.rb:143
580
+ #: lib/statsample/reliability/multiscaleanalysis.rb:145
533
581
  msgid "Reliability analysis of scales"
534
582
  msgstr ""
535
583
 
536
- #: lib/statsample/reliability/multiscaleanalysis.rb:149
584
+ #: lib/statsample/reliability/multiscaleanalysis.rb:151
537
585
  msgid "Correlation matrix for %s"
538
586
  msgstr ""
539
587
 
540
- #: lib/statsample/reliability/multiscaleanalysis.rb:154
588
+ #: lib/statsample/reliability/multiscaleanalysis.rb:156
541
589
  msgid "PCA for %s"
542
590
  msgstr ""
543
591
 
544
- #: lib/statsample/reliability/multiscaleanalysis.rb:159
592
+ #: lib/statsample/reliability/multiscaleanalysis.rb:161
545
593
  msgid "Principal Axis for %s"
546
594
  msgstr ""
547
595
 
548
- #: lib/statsample/reliability/multiscaleanalysis.rb:165
596
+ #: lib/statsample/reliability/multiscaleanalysis.rb:167
549
597
  msgid "Parallel Analysis for %s"
550
598
  msgstr ""
551
599
 
552
- #: lib/statsample/reliability/multiscaleanalysis.rb:170
600
+ #: lib/statsample/reliability/multiscaleanalysis.rb:172
553
601
  msgid "MAP for %s"
554
602
  msgstr ""
555
603
 
@@ -589,96 +637,96 @@ msgstr ""
589
637
  msgid "No problematic items"
590
638
  msgstr ""
591
639
 
592
- #: lib/statsample/reliability/scaleanalysis.rb:45
640
+ #: lib/statsample/reliability/scaleanalysis.rb:44
593
641
  msgid "Reliability Analisis"
594
642
  msgstr ""
595
643
 
596
- #: lib/statsample/reliability/scaleanalysis.rb:158
644
+ #: lib/statsample/reliability/scaleanalysis.rb:157
597
645
  msgid "Summary for %s with all items"
598
646
  msgstr ""
599
647
 
600
- #: lib/statsample/reliability/scaleanalysis.rb:159
648
+ #: lib/statsample/reliability/scaleanalysis.rb:158
601
649
  msgid "Items"
602
650
  msgstr ""
603
651
 
604
- #: lib/statsample/reliability/scaleanalysis.rb:160
605
- #: lib/statsample/reliability/scaleanalysis.rb:177
652
+ #: lib/statsample/reliability/scaleanalysis.rb:159
653
+ #: lib/statsample/reliability/scaleanalysis.rb:176
606
654
  msgid "Sum mean"
607
655
  msgstr ""
608
656
 
609
- #: lib/statsample/reliability/scaleanalysis.rb:161
657
+ #: lib/statsample/reliability/scaleanalysis.rb:160
610
658
  msgid "S.d. mean"
611
659
  msgstr ""
612
660
 
613
- #: lib/statsample/reliability/scaleanalysis.rb:163
661
+ #: lib/statsample/reliability/scaleanalysis.rb:162
614
662
  msgid "Deleted items"
615
663
  msgstr ""
616
664
 
617
- #: lib/statsample/reliability/scaleanalysis.rb:173
665
+ #: lib/statsample/reliability/scaleanalysis.rb:172
618
666
  msgid "Summary for %s"
619
667
  msgstr ""
620
668
 
621
- #: lib/statsample/reliability/scaleanalysis.rb:174
669
+ #: lib/statsample/reliability/scaleanalysis.rb:173
622
670
  msgid "Valid Items"
623
671
  msgstr ""
624
672
 
625
- #: lib/statsample/reliability/scaleanalysis.rb:176
673
+ #: lib/statsample/reliability/scaleanalysis.rb:175
626
674
  msgid "Valid cases"
627
675
  msgstr ""
628
676
 
629
- #: lib/statsample/reliability/scaleanalysis.rb:178
677
+ #: lib/statsample/reliability/scaleanalysis.rb:177
630
678
  msgid "Sum sd"
631
679
  msgstr ""
632
680
 
633
- #: lib/statsample/reliability/scaleanalysis.rb:180
681
+ #: lib/statsample/reliability/scaleanalysis.rb:179
634
682
  msgid "Sum median"
635
683
  msgstr ""
636
684
 
637
- #: lib/statsample/reliability/scaleanalysis.rb:182
685
+ #: lib/statsample/reliability/scaleanalysis.rb:181
638
686
  msgid "Item mean"
639
687
  msgstr ""
640
688
 
641
- #: lib/statsample/reliability/scaleanalysis.rb:183
689
+ #: lib/statsample/reliability/scaleanalysis.rb:182
642
690
  msgid "Item sd"
643
691
  msgstr ""
644
692
 
645
- #: lib/statsample/reliability/scaleanalysis.rb:185
693
+ #: lib/statsample/reliability/scaleanalysis.rb:184
646
694
  msgid "Skewness"
647
695
  msgstr ""
648
696
 
649
- #: lib/statsample/reliability/scaleanalysis.rb:186
697
+ #: lib/statsample/reliability/scaleanalysis.rb:185
650
698
  msgid "Kurtosis"
651
699
  msgstr ""
652
700
 
653
- #: lib/statsample/reliability/scaleanalysis.rb:188
701
+ #: lib/statsample/reliability/scaleanalysis.rb:187
654
702
  msgid "Cronbach's alpha"
655
703
  msgstr ""
656
704
 
657
- #: lib/statsample/reliability/scaleanalysis.rb:189
705
+ #: lib/statsample/reliability/scaleanalysis.rb:188
658
706
  msgid "Standarized Cronbach's alpha"
659
707
  msgstr ""
660
708
 
661
- #: lib/statsample/reliability/scaleanalysis.rb:190
709
+ #: lib/statsample/reliability/scaleanalysis.rb:189
662
710
  msgid "Mean rpb"
663
711
  msgstr ""
664
712
 
665
- #: lib/statsample/reliability/scaleanalysis.rb:192
713
+ #: lib/statsample/reliability/scaleanalysis.rb:191
666
714
  msgid "Variances mean"
667
715
  msgstr ""
668
716
 
669
- #: lib/statsample/reliability/scaleanalysis.rb:193
717
+ #: lib/statsample/reliability/scaleanalysis.rb:192
670
718
  msgid "Covariances mean"
671
719
  msgstr ""
672
720
 
673
- #: lib/statsample/reliability/scaleanalysis.rb:197
721
+ #: lib/statsample/reliability/scaleanalysis.rb:196
674
722
  msgid "Items for obtain alpha(0.8) : %d"
675
723
  msgstr ""
676
724
 
677
- #: lib/statsample/reliability/scaleanalysis.rb:198
725
+ #: lib/statsample/reliability/scaleanalysis.rb:197
678
726
  msgid "Items for obtain alpha(0.9) : %d"
679
727
  msgstr ""
680
728
 
681
- #: lib/statsample/reliability/scaleanalysis.rb:206
729
+ #: lib/statsample/reliability/scaleanalysis.rb:205
682
730
  msgid "Items report for %s"
683
731
  msgstr ""
684
732
 
@@ -846,54 +894,54 @@ msgstr ""
846
894
  msgid "%s(percentil)"
847
895
  msgstr ""
848
896
 
849
- #: lib/statsample/vector.rb:667
897
+ #: lib/statsample/vector.rb:778
850
898
  msgid "n :%d"
851
899
  msgstr ""
852
900
 
853
- #: lib/statsample/vector.rb:668
901
+ #: lib/statsample/vector.rb:779
854
902
  msgid "n valid:%d"
855
903
  msgstr ""
856
904
 
857
- #: lib/statsample/vector.rb:669
905
+ #: lib/statsample/vector.rb:780
858
906
  msgid "factors:%s"
859
907
  msgstr ""
860
908
 
861
- #: lib/statsample/vector.rb:670
909
+ #: lib/statsample/vector.rb:781
862
910
  msgid "mode: %s"
863
911
  msgstr ""
864
912
 
865
- #: lib/statsample/vector.rb:671
913
+ #: lib/statsample/vector.rb:782
866
914
  msgid "Distribution"
867
915
  msgstr ""
868
916
 
869
- #: lib/statsample/vector.rb:677
917
+ #: lib/statsample/vector.rb:788
870
918
  msgid "median: %s"
871
919
  msgstr ""
872
920
 
873
- #: lib/statsample/vector.rb:679
921
+ #: lib/statsample/vector.rb:790
874
922
  msgid "mean: %0.4f"
875
923
  msgstr ""
876
924
 
877
- #: lib/statsample/vector.rb:680
925
+ #: lib/statsample/vector.rb:791
878
926
  msgid "sd: %0.4f"
879
927
  msgstr ""
880
928
 
881
- #: lib/statsample/dataset.rb:134
929
+ #: lib/statsample/dataset.rb:161
882
930
  msgid "Dataset %d"
883
931
  msgstr ""
884
932
 
885
- #: lib/statsample/dataset.rb:427
933
+ #: lib/statsample/dataset.rb:457
886
934
  msgid "Sum from %s"
887
935
  msgstr ""
888
936
 
889
- #: lib/statsample/dataset.rb:480
937
+ #: lib/statsample/dataset.rb:510
890
938
  msgid "Means from %s"
891
939
  msgstr ""
892
940
 
893
- #: lib/statsample/dataset.rb:704
941
+ #: lib/statsample/dataset.rb:734
894
942
  msgid "%s(filtered)"
895
943
  msgstr ""
896
944
 
897
- #: lib/statsample/dataset.rb:926
945
+ #: lib/statsample/dataset.rb:956
898
946
  msgid "Cases: %d"
899
947
  msgstr ""
@@ -2,6 +2,7 @@ $:.unshift(File.expand_path(File.dirname(__FILE__)+'/../lib/'))
2
2
  $:.unshift(File.expand_path(File.dirname(__FILE__)+'/'))
3
3
 
4
4
  require 'minitest/unit'
5
+ require 'mocha'
5
6
  require 'tempfile'
6
7
  require 'tmpdir'
7
8
  require 'shoulda'
@@ -1,7 +1,10 @@
1
1
  require(File.expand_path(File.dirname(__FILE__)+'/helpers_tests.rb'))
2
- require 'mocha'
2
+
3
3
  class StatsampleAnalysisTestCase < MiniTest::Unit::TestCase
4
4
  context(Statsample::Analysis) do
5
+ setup do
6
+ Statsample::Analysis.clear_analysis
7
+ end
5
8
  should "store() should create and store Statsample::Analysis::Suite" do
6
9
  Statsample::Analysis.store(:first) do
7
10
  a=1
@@ -9,12 +12,77 @@ class StatsampleAnalysisTestCase < MiniTest::Unit::TestCase
9
12
  assert(Statsample::Analysis.stored_analysis[:first])
10
13
  assert(Statsample::Analysis.stored_analysis[:first].is_a? Statsample::Analysis::Suite)
11
14
  end
15
+
16
+ should "ss_analysis should create an Statsample::Analysis" do
17
+ ss_analysis(:first) {a=1}
18
+ end
12
19
  should "store last created analysis" do
13
20
  an=Statsample::Analysis.store(:first) do
14
21
  a=1
15
22
  end
16
23
  assert_equal(an,Statsample::Analysis.last)
17
24
  end
25
+
26
+ should "add_to_reportbuilder() add sections to reportbuilder object" do
27
+ rb=mock()
28
+ rb.expects(:add).with {|value| value.is_a? ReportBuilder::Section and value.name==:first}
29
+ rb.expects(:add).with {|value| value.is_a? ReportBuilder::Section and value.name==:second}
30
+
31
+ Statsample::Analysis.store(:first) do
32
+ echo "first","second"
33
+ end
34
+ Statsample::Analysis.store(:second) do
35
+ echo "third"
36
+ end
37
+ Statsample::Analysis.add_to_reportbuilder(rb,:first,:second)
38
+ end
39
+ should "to_text returns the same as a normal ReportBuilder object" do
40
+ rb=ReportBuilder.new(:name=>:test)
41
+ section=ReportBuilder::Section.new(:name=>"first")
42
+ a=[1,2,3].to_scale
43
+ section.add("first")
44
+ section.add(a)
45
+ rb.add(section)
46
+ exp=rb.to_text
47
+ an=ss_analysis(:first) {
48
+ echo 'first'
49
+ summary(a)
50
+ }
51
+ obs=Statsample::Analysis.to_text(:first)
52
+
53
+ assert_equal(exp.split("\n")[1,exp.size], obs.split("\n")[1,obs.size])
54
+ end
55
+
56
+ should "run() execute all analysis by default" do
57
+ m1=mock()
58
+ m1.expects(:run).once
59
+ m1.expects(:hide).once
60
+
61
+ Statsample::Analysis.store(:first) do
62
+ m1.run
63
+ end
64
+ Statsample::Analysis.store(:second) do
65
+ m1.hide
66
+ end
67
+
68
+ # Should run all test
69
+ Statsample::Analysis.run
70
+ end
71
+
72
+ should "run() execute blocks specificed on parameters" do
73
+ m1=mock()
74
+ m1.expects(:run).once
75
+ m1.expects(:hide).never
76
+ Statsample::Analysis.store(:first) do
77
+ m1.run
78
+ end
79
+ Statsample::Analysis.store(:second) do
80
+ m1.hide
81
+ end
82
+ # Should run all test
83
+ Statsample::Analysis.run(:first)
84
+ end
85
+
18
86
  context(Statsample::Analysis::Suite) do
19
87
  should "echo() uses output#puts with same arguments" do
20
88
  an=Statsample::Analysis::Suite.new(:output)
@@ -85,21 +153,12 @@ class StatsampleAnalysisTestCase < MiniTest::Unit::TestCase
85
153
  output=mock()
86
154
  output.expects(:puts).with(5.5)
87
155
  an=Statsample::Analysis.store(:simple, :output=>output) do
88
- ds=data_frame(:x=>c(1..10),:y=>c(1..10))
156
+ ds=data_frame(:x=>vector(1..10),:y=>vector(1..10))
89
157
  attach(ds)
90
158
  echo x.mean
91
159
  end
92
160
  an.run
93
161
  end
94
- should "rnorm returns a random normal distribution vector" do
95
- an=Statsample::Analysis::Suite.new(:simple)
96
- v=an.rnorm(1000)
97
- assert_in_delta(0,v.mean,0.09)
98
- assert_in_delta(1,v.sd,0.09)
99
- v=an.rnorm(1000,5,10)
100
- assert_in_delta(5,v.mean,0.9)
101
- assert_in_delta(10,v.sd,0.9)
102
- end
103
162
  end
104
163
  context(Statsample::Analysis::SuiteReportBuilder) do
105
164
  should "echo() use add on rb object" do