statsample 0.13.1 → 0.14.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.
@@ -6,8 +6,8 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: statsample 0.13.0\n"
10
- "POT-Creation-Date: 2010-06-21 16:08-0400\n"
9
+ "Project-Id-Version: statsample 0.13.1\n"
10
+ "POT-Creation-Date: 2010-08-10 17:00-0400\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"
@@ -24,10 +24,8 @@ msgstr ""
24
24
  msgid "Mean and standard deviation"
25
25
  msgstr ""
26
26
 
27
- #: lib/statsample/test/t.rb:209 lib/statsample/factor/pca.rb:144
28
- #: lib/statsample/factor/pca.rb:149 lib/statsample/factor/pca.rb:155
29
- #: lib/statsample/factor/principalaxis.rb:180
30
- #: lib/statsample/factor/principalaxis.rb:185
27
+ #: lib/statsample/test/t.rb:209 lib/statsample/factor/pca.rb:169
28
+ #: lib/statsample/factor/principalaxis.rb:190
31
29
  msgid "Variable"
32
30
  msgstr ""
33
31
 
@@ -309,7 +307,6 @@ msgid "Number or factors to preserve: %d"
309
307
  msgstr ""
310
308
 
311
309
  #: lib/statsample/factor/parallelanalysis.rb:79
312
- #: lib/statsample/factor/pca.rb:149 lib/statsample/factor/principalaxis.rb:185
313
310
  msgid "Eigenvalues"
314
311
  msgstr ""
315
312
 
@@ -325,131 +322,207 @@ msgstr ""
325
322
  msgid "preserve?"
326
323
  msgstr ""
327
324
 
328
- #: lib/statsample/factor/pca.rb:43
325
+ #: lib/statsample/factor/pca.rb:51
329
326
  msgid "Principal Component Analysis"
330
327
  msgstr ""
331
328
 
332
- #: lib/statsample/factor/pca.rb:143 lib/statsample/factor/principalaxis.rb:178
329
+ #: lib/statsample/factor/pca.rb:118
330
+ msgid "Component matrix"
331
+ msgstr ""
332
+
333
+ #: lib/statsample/factor/pca.rb:168 lib/statsample/factor/principalaxis.rb:188
333
334
  msgid "Number of factors: %d"
334
335
  msgstr ""
335
336
 
336
- #: lib/statsample/factor/pca.rb:144 lib/statsample/factor/principalaxis.rb:180
337
+ #: lib/statsample/factor/pca.rb:169 lib/statsample/factor/principalaxis.rb:190
337
338
  msgid "Communalities"
338
339
  msgstr ""
339
340
 
340
- #: lib/statsample/factor/pca.rb:144 lib/statsample/factor/principalaxis.rb:180
341
+ #: lib/statsample/factor/pca.rb:169 lib/statsample/factor/principalaxis.rb:190
341
342
  msgid "Initial"
342
343
  msgstr ""
343
344
 
344
- #: lib/statsample/factor/pca.rb:144 lib/statsample/factor/principalaxis.rb:180
345
+ #: lib/statsample/factor/pca.rb:169 lib/statsample/factor/principalaxis.rb:190
345
346
  msgid "Extraction"
346
347
  msgstr ""
347
348
 
348
- #: lib/statsample/factor/pca.rb:149 lib/statsample/factor/principalaxis.rb:185
349
- msgid "Value"
349
+ #: lib/statsample/factor/pca.rb:175
350
+ msgid "Total Variance Explained"
351
+ msgstr ""
352
+
353
+ #: lib/statsample/factor/pca.rb:175
354
+ msgid "Component"
355
+ msgstr ""
356
+
357
+ #: lib/statsample/factor/pca.rb:175
358
+ msgid "E.Total"
359
+ msgstr ""
360
+
361
+ #: lib/statsample/factor/pca.rb:175
362
+ msgid "%"
350
363
  msgstr ""
351
364
 
352
- #: lib/statsample/factor/pca.rb:155 lib/statsample/factor/principalaxis.rb:190
353
- msgid "Component Matrix"
365
+ #: lib/statsample/factor/pca.rb:175
366
+ msgid "Cum. %"
354
367
  msgstr ""
355
368
 
356
- #: lib/statsample/factor/principalaxis.rb:63
369
+ #: lib/statsample/factor/pca.rb:179
370
+ msgid "Component %d"
371
+ msgstr ""
372
+
373
+ #: lib/statsample/factor/principalaxis.rb:64
357
374
  msgid "Variable %d"
358
375
  msgstr ""
359
376
 
360
- #: lib/statsample/factor/principalaxis.rb:179
377
+ #: lib/statsample/factor/principalaxis.rb:140
378
+ msgid "Factor Matrix"
379
+ msgstr ""
380
+
381
+ #: lib/statsample/factor/principalaxis.rb:189
361
382
  msgid "Iterations: %d"
362
383
  msgstr ""
363
384
 
364
- #: lib/statsample/reliability/multiscaleanalysis.rb:53
385
+ #: lib/statsample/factor/principalaxis.rb:195
386
+ msgid "Total Variance"
387
+ msgstr ""
388
+
389
+ #: lib/statsample/factor/principalaxis.rb:195
390
+ msgid "Factor"
391
+ msgstr ""
392
+
393
+ #: lib/statsample/factor/principalaxis.rb:195
394
+ msgid "I.E.Total"
395
+ msgstr ""
396
+
397
+ #: lib/statsample/factor/principalaxis.rb:195
398
+ msgid "I.E. %"
399
+ msgstr ""
400
+
401
+ #: lib/statsample/factor/principalaxis.rb:195
402
+ msgid "I.E.Cum. %"
403
+ msgstr ""
404
+
405
+ #: lib/statsample/factor/principalaxis.rb:196
406
+ msgid "S.L.Total"
407
+ msgstr ""
408
+
409
+ #: lib/statsample/factor/principalaxis.rb:196
410
+ msgid "S.L. %"
411
+ msgstr ""
412
+
413
+ #: lib/statsample/factor/principalaxis.rb:196
414
+ msgid "S.L.Cum. %"
415
+ msgstr ""
416
+
417
+ #: lib/statsample/factor/principalaxis.rb:203
418
+ msgid "Factor %d"
419
+ msgstr ""
420
+
421
+ #: lib/statsample/factor/rotation.rb:35
422
+ msgid "%s rotation"
423
+ msgstr ""
424
+
425
+ #: lib/statsample/factor/rotation.rb:125
426
+ msgid "Rotated Component matrix"
427
+ msgstr ""
428
+
429
+ #: lib/statsample/factor/rotation.rb:142
430
+ msgid "Component transformation matrix"
431
+ msgstr ""
432
+
433
+ #: lib/statsample/reliability/multiscaleanalysis.rb:57
365
434
  msgid "Multiple Scale analysis"
366
435
  msgstr ""
367
436
 
368
- #: lib/statsample/reliability/multiscaleanalysis.rb:79
437
+ #: lib/statsample/reliability/multiscaleanalysis.rb:85
369
438
  msgid "Scale %s"
370
439
  msgstr ""
371
440
 
372
- #: lib/statsample/reliability/multiscaleanalysis.rb:110
441
+ #: lib/statsample/reliability/multiscaleanalysis.rb:125
373
442
  msgid "Reliability analysis of scales"
374
443
  msgstr ""
375
444
 
376
- #: lib/statsample/reliability/multiscaleanalysis.rb:116
445
+ #: lib/statsample/reliability/multiscaleanalysis.rb:131
377
446
  msgid "Correlation matrix for %s"
378
447
  msgstr ""
379
448
 
380
- #: lib/statsample/reliability/multiscaleanalysis.rb:121
449
+ #: lib/statsample/reliability/multiscaleanalysis.rb:136
381
450
  msgid "PCA for %s"
382
451
  msgstr ""
383
452
 
384
- #: lib/statsample/reliability/multiscaleanalysis.rb:126
453
+ #: lib/statsample/reliability/multiscaleanalysis.rb:141
385
454
  msgid "Principal Axis for %s"
386
455
  msgstr ""
387
456
 
388
- #: lib/statsample/reliability/scaleanalysis.rb:169
457
+ #: lib/statsample/reliability/multiscaleanalysis.rb:147
458
+ msgid "Parallel Analysis for %s"
459
+ msgstr ""
460
+
461
+ #: lib/statsample/reliability/scaleanalysis.rb:177
389
462
  msgid "Summary for %s"
390
463
  msgstr ""
391
464
 
392
- #: lib/statsample/reliability/scaleanalysis.rb:170
465
+ #: lib/statsample/reliability/scaleanalysis.rb:178
393
466
  msgid "Items"
394
467
  msgstr ""
395
468
 
396
- #: lib/statsample/reliability/scaleanalysis.rb:171
469
+ #: lib/statsample/reliability/scaleanalysis.rb:179
397
470
  msgid "Valid cases"
398
471
  msgstr ""
399
472
 
400
- #: lib/statsample/reliability/scaleanalysis.rb:172
473
+ #: lib/statsample/reliability/scaleanalysis.rb:180
401
474
  msgid "Sum mean"
402
475
  msgstr ""
403
476
 
404
- #: lib/statsample/reliability/scaleanalysis.rb:173
477
+ #: lib/statsample/reliability/scaleanalysis.rb:181
405
478
  msgid "Sum sd"
406
479
  msgstr ""
407
480
 
408
- #: lib/statsample/reliability/scaleanalysis.rb:174
481
+ #: lib/statsample/reliability/scaleanalysis.rb:182
409
482
  msgid "Sum variance"
410
483
  msgstr ""
411
484
 
412
- #: lib/statsample/reliability/scaleanalysis.rb:175
485
+ #: lib/statsample/reliability/scaleanalysis.rb:183
413
486
  msgid "Sum median"
414
487
  msgstr ""
415
488
 
416
- #: lib/statsample/reliability/scaleanalysis.rb:177
489
+ #: lib/statsample/reliability/scaleanalysis.rb:185
417
490
  msgid "Item mean"
418
491
  msgstr ""
419
492
 
420
- #: lib/statsample/reliability/scaleanalysis.rb:178
493
+ #: lib/statsample/reliability/scaleanalysis.rb:186
421
494
  msgid "Skewness"
422
495
  msgstr ""
423
496
 
424
- #: lib/statsample/reliability/scaleanalysis.rb:179
497
+ #: lib/statsample/reliability/scaleanalysis.rb:187
425
498
  msgid "Kurtosis"
426
499
  msgstr ""
427
500
 
428
- #: lib/statsample/reliability/scaleanalysis.rb:181
501
+ #: lib/statsample/reliability/scaleanalysis.rb:189
429
502
  msgid "Cronbach's alpha"
430
503
  msgstr ""
431
504
 
432
- #: lib/statsample/reliability/scaleanalysis.rb:182
505
+ #: lib/statsample/reliability/scaleanalysis.rb:190
433
506
  msgid "Standarized Cronbach's alpha"
434
507
  msgstr ""
435
508
 
436
- #: lib/statsample/reliability/scaleanalysis.rb:183
509
+ #: lib/statsample/reliability/scaleanalysis.rb:191
437
510
  msgid "Variances mean"
438
511
  msgstr ""
439
512
 
440
- #: lib/statsample/reliability/scaleanalysis.rb:184
513
+ #: lib/statsample/reliability/scaleanalysis.rb:192
441
514
  msgid "Covariances mean"
442
515
  msgstr ""
443
516
 
444
- #: lib/statsample/reliability/scaleanalysis.rb:186
517
+ #: lib/statsample/reliability/scaleanalysis.rb:194
445
518
  msgid "items for obtain alpha(0.8) : %d"
446
519
  msgstr ""
447
520
 
448
- #: lib/statsample/reliability/scaleanalysis.rb:187
521
+ #: lib/statsample/reliability/scaleanalysis.rb:195
449
522
  msgid "items for obtain alpha(0.9) : %d"
450
523
  msgstr ""
451
524
 
452
- #: lib/statsample/reliability/scaleanalysis.rb:194
525
+ #: lib/statsample/reliability/scaleanalysis.rb:202
453
526
  msgid "Items report for %s"
454
527
  msgstr ""
455
528
 
@@ -529,51 +602,51 @@ msgstr ""
529
602
  msgid "Y%d"
530
603
  msgstr ""
531
604
 
532
- #: lib/statsample/matrix.rb:110
605
+ #: lib/statsample/matrix.rb:115
533
606
  msgid "Covariate matrix %d"
534
607
  msgstr ""
535
608
 
536
- #: lib/statsample/matrix.rb:152
609
+ #: lib/statsample/matrix.rb:157
537
610
  msgid "Correlation"
538
611
  msgstr ""
539
612
 
540
- #: lib/statsample/matrix.rb:152
613
+ #: lib/statsample/matrix.rb:157
541
614
  msgid "Covariance"
542
615
  msgstr ""
543
616
 
544
- #: lib/statsample/matrix.rb:152
617
+ #: lib/statsample/matrix.rb:157
545
618
  msgid " Matrix"
546
619
  msgstr ""
547
620
 
548
- #: lib/statsample/vector.rb:614
621
+ #: lib/statsample/vector.rb:620
549
622
  msgid "n :%d"
550
623
  msgstr ""
551
624
 
552
- #: lib/statsample/vector.rb:615
625
+ #: lib/statsample/vector.rb:621
553
626
  msgid "n valid:%d"
554
627
  msgstr ""
555
628
 
556
- #: lib/statsample/vector.rb:616
629
+ #: lib/statsample/vector.rb:622
557
630
  msgid "factors:%s"
558
631
  msgstr ""
559
632
 
560
- #: lib/statsample/vector.rb:617
633
+ #: lib/statsample/vector.rb:623
561
634
  msgid "mode: %s"
562
635
  msgstr ""
563
636
 
564
- #: lib/statsample/vector.rb:618
637
+ #: lib/statsample/vector.rb:624
565
638
  msgid "Distribution"
566
639
  msgstr ""
567
640
 
568
- #: lib/statsample/vector.rb:624
641
+ #: lib/statsample/vector.rb:630
569
642
  msgid "median: %s"
570
643
  msgstr ""
571
644
 
572
- #: lib/statsample/vector.rb:626
645
+ #: lib/statsample/vector.rb:632
573
646
  msgid "mean: %0.4f"
574
647
  msgstr ""
575
648
 
576
- #: lib/statsample/vector.rb:627
649
+ #: lib/statsample/vector.rb:633
577
650
  msgid "sd: %0.4f"
578
651
  msgstr ""
579
652
 
@@ -1,6 +1,31 @@
1
1
  require(File.dirname(__FILE__)+'/helpers_tests.rb')
2
2
 
3
3
  class StatsampleFactorTestCase < MiniTest::Unit::TestCase
4
+ def test_parallelanalysis
5
+ pa=Statsample::Factor::ParallelAnalysis.with_random_data(305,8,150)
6
+ assert_in_delta(1.2454, pa.ds_eigenvalues['ev_00001'].mean, 0.01)
7
+ assert_in_delta(1.1542, pa.ds_eigenvalues['ev_00002'].mean, 0.01)
8
+ assert_in_delta(1.0836, pa.ds_eigenvalues['ev_00003'].mean, 0.01)
9
+ end
10
+ def test_map
11
+ fields=%w{height arm.span forearm lower.leg weight bitro.diameter chest.girth chest.width}
12
+ m=Matrix[
13
+ [ 1, 0.846, 0.805, 0.859, 0.473, 0.398, 0.301, 0.382],
14
+ [ 0.846, 1, 0.881, 0.826, 0.376, 0.326, 0.277, 0.415],
15
+ [ 0.805, 0.881, 1, 0.801, 0.38, 0.319, 0.237, 0.345],
16
+ [ 0.859, 0.826, 0.801, 1, 0.436, 0.329, 0.327, 0.365],
17
+ [ 0.473, 0.376, 0.38, 0.436, 1, 0.762, 0.73, 0.629],
18
+ [ 0.398, 0.326, 0.319, 0.329, 0.762, 1, 0.583, 0.577],
19
+ [ 0.301, 0.277, 0.237, 0.327, 0.73, 0.583, 1, 0.539],
20
+ [ 0.382, 0.415, 0.345, 0.365, 0.629, 0.577, 0.539, 1]
21
+ ]
22
+ map=Statsample::Factor::MAP.new(m)
23
+ assert_in_delta(map.minfm, 0.066445,0.00001)
24
+ assert_equal(map.number_of_factors, 2)
25
+ assert_in_delta(map.fm[0], 0.312475,0.00001)
26
+ assert_in_delta(map.fm[1], 0.245121,0.00001)
27
+
28
+ end
4
29
  # Tested with SPSS and R
5
30
  def test_pca
6
31
  a=[2.5, 0.5, 2.2, 1.9, 3.1, 2.3, 2.0, 1.0, 1.5, 1.1].to_scale
@@ -44,7 +69,7 @@ class StatsampleFactorTestCase < MiniTest::Unit::TestCase
44
69
  def test_principalaxis
45
70
  matrix=::Matrix[
46
71
  [1.0, 0.709501601093587, 0.877596585880047, 0.272219316266807], [0.709501601093587, 1.0, 0.291633797330304, 0.871141831433844], [0.877596585880047, 0.291633797330304, 1.0, -0.213373722977167], [0.272219316266807, 0.871141831433844, -0.213373722977167, 1.0]]
47
- fa=Statsample::Factor::PrincipalAxis.new(matrix,:m=>1)
72
+ fa=Statsample::Factor::PrincipalAxis.new(matrix,:m=>1, :max_iterations=>50)
48
73
 
49
74
  cm=::Matrix[[0.923],[0.912],[0.507],[0.483]]
50
75
 
@@ -56,12 +81,12 @@ class StatsampleFactorTestCase < MiniTest::Unit::TestCase
56
81
  }
57
82
  eigen1=2.175
58
83
  assert_in_delta(eigen1, fa.eigenvalues[0],0.001)
59
-
84
+ assert(fa.summary.size>0)
60
85
  fa=Statsample::Factor::PrincipalAxis.new(matrix,:smc=>false)
86
+
61
87
  assert_raise RuntimeError do
62
88
  fa.iterate
63
89
  end
64
- assert(fa.summary.size>0)
65
90
 
66
91
  end
67
92
 
@@ -82,6 +107,7 @@ class StatsampleFactorTestCase < MiniTest::Unit::TestCase
82
107
  assert(!varimax.h2.nil?, "H2 shouldn't be empty")
83
108
 
84
109
  _test_matrix(expected,varimax.rotated)
110
+ assert(varimax.summary.size>0)
85
111
  end
86
112
  def _test_matrix(a,b)
87
113
  a.row_size.times {|i|
@@ -2,6 +2,8 @@ require(File.dirname(__FILE__)+'/helpers_tests.rb')
2
2
 
3
3
 
4
4
  class StatsampleMatrixTestCase < MiniTest::Unit::TestCase
5
+
6
+
5
7
  def test_covariate
6
8
  a=Matrix[[1.0, 0.3, 0.2], [0.3, 1.0, 0.5], [0.2, 0.5, 1.0]]
7
9
  a.extend Statsample::CovariateMatrix
@@ -122,52 +122,52 @@ class StatsampleReliabilityTestCase < MiniTest::Unit::TestCase
122
122
  }
123
123
  end
124
124
  end
125
- should "Retrieve correct ScaleAnalysis for whole scale" do
126
- sa=Statsample::Reliability::ScaleAnalysis.new(@ds, :name=>"Scale complete")
127
- assert_equal(sa.variances_mean, @msa.scale("complete").variances_mean)
128
- end
129
- should "Retrieve correct ScaleAnalysis for each scale" do
130
- @scales.times {|s|
131
- sa=Statsample::Reliability::ScaleAnalysis.new(@ds.dup(@items_per_scale.times.map {|i| "#{s}_#{i}"}), :name=>"Scale #{s}")
132
- assert_equal(sa.variances_mean,@msa.scale("scale_#{s}").variances_mean)
133
- }
134
- end
135
- should "retrieve correct correlation matrix for each scale" do
136
- vectors={'complete'=>@ds.vector_sum}
137
- @scales.times {|s|
138
- vectors["scale_#{s}"]=@ds.dup(@items_per_scale.times.map {|i| "#{s}_#{i}"}).vector_sum
139
- }
140
- ds2=vectors.to_dataset
141
- assert_equal(Statsample::Bivariate.correlation_matrix(ds2), @msa.correlation_matrix)
142
- end
143
- should "delete scale using delete_scale" do
144
- @msa.delete_scale("complete")
145
- assert_equal(@msa.scales.keys.sort, @scales.times.map {|s| "scale_#{s}"})
146
- end
147
- should "retrieve pca for scales" do
148
- @msa.delete_scale("complete")
149
- vectors=Hash.new
150
- @scales.times {|s|
151
- vectors["scale_#{s}"]=@ds.dup(@items_per_scale.times.map {|i| "#{s}_#{i}"}).vector_sum
152
- }
153
- ds2=vectors.to_dataset
154
- cor_matrix=Statsample::Bivariate.correlation_matrix(ds2)
155
- m=3
156
- pca=Statsample::Factor::PCA.new(cor_matrix, :m=>m)
157
- assert_equal(pca.component_matrix, @msa.pca(:m=>m).component_matrix)
158
- end
159
- should "retrieve acceptable summary" do
160
- @msa.delete_scale("scale_0")
161
- @msa.delete_scale("scale_1")
162
- @msa.delete_scale("scale_2")
163
-
164
-
165
- #@msa.summary_correlation_matrix=true
166
- #@msa.summary_pca=true
167
-
168
-
169
- assert(@msa.summary.size>0)
170
- end
125
+ should "Retrieve correct ScaleAnalysis for whole scale" do
126
+ sa=Statsample::Reliability::ScaleAnalysis.new(@ds, :name=>"Scale complete")
127
+ assert_equal(sa.variances_mean, @msa.scale("complete").variances_mean)
128
+ end
129
+ should "Retrieve correct ScaleAnalysis for each scale" do
130
+ @scales.times {|s|
131
+ sa=Statsample::Reliability::ScaleAnalysis.new(@ds.dup(@items_per_scale.times.map {|i| "#{s}_#{i}"}), :name=>"Scale #{s}")
132
+ assert_equal(sa.variances_mean,@msa.scale("scale_#{s}").variances_mean)
133
+ }
134
+ end
135
+ should "retrieve correct correlation matrix for each scale" do
136
+ vectors={'complete' => @ds.vector_sum}
137
+ @scales.times {|s|
138
+ vectors["scale_#{s}"]=@ds.dup(@items_per_scale.times.map {|i| "#{s}_#{i}"}).vector_sum
139
+ }
140
+ ds2=vectors.to_dataset
141
+ assert_equal(Statsample::Bivariate.correlation_matrix(ds2), @msa.correlation_matrix)
142
+ end
143
+ should "delete scale using delete_scale" do
144
+ @msa.delete_scale("complete")
145
+ assert_equal(@msa.scales.keys.sort, @scales.times.map {|s| "scale_#{s}"})
146
+ end
147
+ should "retrieve pca for scales" do
148
+ @msa.delete_scale("complete")
149
+ vectors=Hash.new
150
+ @scales.times {|s|
151
+ vectors["scale_#{s}"]=@ds.dup(@items_per_scale.times.map {|i| "#{s}_#{i}"}).vector_sum
152
+ }
153
+ ds2=vectors.to_dataset
154
+ cor_matrix=Statsample::Bivariate.correlation_matrix(ds2)
155
+ m=3
156
+ pca=Statsample::Factor::PCA.new(cor_matrix, :m=>m)
157
+ assert_equal(pca.component_matrix, @msa.pca(:m=>m).component_matrix)
158
+ end
159
+ should "retrieve acceptable summary" do
160
+ @msa.delete_scale("scale_0")
161
+ @msa.delete_scale("scale_1")
162
+ @msa.delete_scale("scale_2")
163
+
164
+
165
+ #@msa.summary_correlation_matrix=true
166
+ #@msa.summary_pca=true
167
+
168
+
169
+ assert(@msa.summary.size>0)
170
+ end
171
171
  end
172
172
  context Statsample::Reliability::ScaleAnalysis do
173
173
  setup do