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.
- data.tar.gz.sig +0 -0
- data/History.txt +15 -0
- data/Manifest.txt +4 -0
- data/README.txt +11 -3
- data/Rakefile +2 -2
- data/data/hartman_23.matrix +9 -0
- data/examples/correlation_matrix.rb +1 -1
- data/examples/velicer_map_test.rb +35 -0
- data/lib/distribution/chisquare.rb +2 -2
- data/lib/statsample.rb +1 -1
- data/lib/statsample/bivariate/pearson.rb +0 -1
- data/lib/statsample/converters.rb +2 -2
- data/lib/statsample/crosstab.rb +1 -1
- data/lib/statsample/factor.rb +3 -1
- data/lib/statsample/factor/map.rb +102 -0
- data/lib/statsample/factor/parallelanalysis.rb +54 -24
- data/lib/statsample/factor/pca.rb +46 -28
- data/lib/statsample/factor/principalaxis.rb +54 -22
- data/lib/statsample/factor/rotation.rb +51 -4
- data/lib/statsample/matrix.rb +14 -14
- data/lib/statsample/reliability.rb +1 -0
- data/lib/statsample/reliability/multiscaleanalysis.rb +35 -10
- data/lib/statsample/reliability/scaleanalysis.rb +10 -9
- data/lib/statsample/test.rb +12 -11
- data/lib/statsample/test/chisquare.rb +43 -0
- data/lib/statsample/vector.rb +18 -11
- data/po/es/statsample.mo +0 -0
- data/po/es/statsample.po +151 -85
- data/po/statsample.pot +126 -53
- data/test/test_factor.rb +29 -3
- data/test/test_matrix.rb +2 -0
- data/test/test_reliability.rb +46 -46
- data/test/test_rserve_extension.rb +2 -2
- data/test/test_stest.rb +16 -2
- data/test/test_vector.rb +10 -1
- metadata +14 -9
- metadata.gz.sig +0 -0
@@ -12,7 +12,7 @@ class StatsampleRserveExtensionTestCase < MiniTest::Unit::TestCase
|
|
12
12
|
should "return a valid rexp for numeric vector" do
|
13
13
|
a=100.times.map {|i| rand()>0.9 ? nil : i+rand() }.to_scale
|
14
14
|
rexp=a.to_REXP
|
15
|
-
|
15
|
+
assert(rexp.is_a? Rserve::REXP::Double)
|
16
16
|
assert_equal(rexp.to_ruby,a.data_with_nils)
|
17
17
|
@r.assign 'a',rexp
|
18
18
|
assert_equal(a.data_with_nils, @r.eval('a').to_ruby)
|
@@ -23,7 +23,7 @@ class StatsampleRserveExtensionTestCase < MiniTest::Unit::TestCase
|
|
23
23
|
c=100.times.map {|i| rand()>0.9 ? nil : i+rand() }.to_scale
|
24
24
|
ds={'a'=>a,'b'=>b,'c'=>c}.to_dataset
|
25
25
|
rexp=ds.to_REXP
|
26
|
-
|
26
|
+
assert(rexp.is_a? Rserve::REXP::GenericVector)
|
27
27
|
ret=rexp.to_ruby
|
28
28
|
assert_equal(a.data_with_nils, ret['a'])
|
29
29
|
@r.assign 'df', rexp
|
data/test/test_stest.rb
CHANGED
@@ -2,15 +2,29 @@ require(File.dirname(__FILE__)+'/helpers_tests.rb')
|
|
2
2
|
|
3
3
|
|
4
4
|
class StatsampleTestTestCase < MiniTest::Unit::TestCase
|
5
|
-
def
|
5
|
+
def test_chi_square_matrix_with_expected
|
6
6
|
real=Matrix[[95,95],[45,155]]
|
7
7
|
expected=Matrix[[68,122],[72,128]]
|
8
8
|
assert_nothing_raised do
|
9
9
|
chi=Statsample::Test.chi_square(real,expected)
|
10
10
|
end
|
11
|
-
chi=Statsample::Test.chi_square(real,expected)
|
11
|
+
chi=Statsample::Test.chi_square(real,expected).chi_square
|
12
12
|
assert_in_delta(32.53,chi,0.1)
|
13
|
+
|
13
14
|
end
|
15
|
+
def test_chi_square_matrix_only_observed
|
16
|
+
observed=Matrix[[20,30,40],[30,40,50],[60,70,80],[10,20,40]]
|
17
|
+
assert_nothing_raised do
|
18
|
+
chi=Statsample::Test.chi_square(observed)
|
19
|
+
end
|
20
|
+
chi=Statsample::Test.chi_square(observed)
|
21
|
+
assert_in_delta(9.5602, chi.chi_square, 0.0001)
|
22
|
+
assert_in_delta(0.1444, chi.probability, 0.0001)
|
23
|
+
|
24
|
+
assert_equal(6, chi.df)
|
25
|
+
|
26
|
+
end
|
27
|
+
|
14
28
|
def test_u_mannwhitney
|
15
29
|
a=[1,2,3,4,5,6].to_scale
|
16
30
|
b=[0,5,7,9,10,11].to_scale
|
data/test/test_vector.rb
CHANGED
@@ -241,6 +241,11 @@ class StatsampleTestVector < MiniTest::Unit::TestCase
|
|
241
241
|
v2=[1,2,3].to_vector()
|
242
242
|
assert_equal(v1,v2)
|
243
243
|
end
|
244
|
+
def test_vector_percentil
|
245
|
+
a=[1,2,2,3,4,5,5,5,6,10].to_scale
|
246
|
+
expected=[10,25,25,40,50,70,70,70,90,100].to_scale
|
247
|
+
assert_equal(expected, a.vector_percentil)
|
248
|
+
end
|
244
249
|
def test_ordinal
|
245
250
|
@c.type=:ordinal
|
246
251
|
assert_equal(5,@c.median)
|
@@ -249,7 +254,11 @@ class StatsampleTestVector < MiniTest::Unit::TestCase
|
|
249
254
|
|
250
255
|
v=[200000, 200000, 210000, 220000, 230000, 250000, 250000, 250000, 270000, 300000, 450000, 130000, 140000, 140000, 140000, 145000, 148000, 165000, 170000, 180000, 180000, 180000, 180000, 180000, 180000 ].to_scale
|
251
256
|
assert_equal(180000,v.median)
|
252
|
-
|
257
|
+
a=[7.0, 7.0, 7.0, 7.0, 7.0, 8.0, 8.0, 8.0, 9.0, 9.0, 10.0, 10.0, 10.0, 10.0, 10.0, 12.0, 12.0, 13.0, 14.0, 14.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0].to_scale
|
258
|
+
assert_equal(4.5, a.percentil(25))
|
259
|
+
assert_equal(6.5, a.percentil(50))
|
260
|
+
assert_equal(9.5, a.percentil(75))
|
261
|
+
assert_equal(3.0, a.percentil(10))
|
253
262
|
end
|
254
263
|
def test_ranked
|
255
264
|
v1=[0.8,1.2,1.2,2.3,18].to_vector(:ordinal)
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 14
|
8
|
+
- 0
|
9
|
+
version: 0.14.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Claudio Bustos
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
rpP0jjs0
|
36
36
|
-----END CERTIFICATE-----
|
37
37
|
|
38
|
-
date: 2010-
|
38
|
+
date: 2010-08-16 00:00:00 -04:00
|
39
39
|
default_executable:
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -126,9 +126,9 @@ dependencies:
|
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
segments:
|
128
128
|
- 0
|
129
|
-
-
|
130
|
-
-
|
131
|
-
version: 0.
|
129
|
+
- 3
|
130
|
+
- 1
|
131
|
+
version: 0.3.1
|
132
132
|
type: :runtime
|
133
133
|
version_requirements: *id007
|
134
134
|
- !ruby/object:Gem::Dependency
|
@@ -191,14 +191,15 @@ description: |-
|
|
191
191
|
Include:
|
192
192
|
* Descriptive statistics: frequencies, median, mean, standard error, skew, kurtosis (and many others).
|
193
193
|
* Imports and exports datasets from and to Excel, CSV and plain text files.
|
194
|
-
* Correlations: Pearson's r, Spearman's rank correlation (rho), point biserial, tau a, tau b
|
194
|
+
* Correlations: Pearson's r, Spearman's rank correlation (rho), point biserial, tau a, tau b and gamma. Tetrachoric and Polychoric correlation provides by +statsample-bivariate-extension+ gem.
|
195
195
|
* Anova: generic and vector-based One-way ANOVA and Two-way ANOVA
|
196
196
|
* Tests: F, T, Levene, U-Mannwhitney.
|
197
197
|
* Regression: Simple, Multiple (OLS), Probit and Logit
|
198
|
-
* Factorial Analysis: Extraction (PCA and Principal Axis), Rotation (Varimax, Equimax, Quartimax) and Parallel Analysis, for estimation of number of factors.
|
198
|
+
* Factorial Analysis: Extraction (PCA and Principal Axis), Rotation (Varimax, Equimax, Quartimax) and Parallel Analysis and Velicer's MAP test, for estimation of number of factors.
|
199
199
|
* Reliability analysis for simple scale and a DSL to easily analyze multiple scales using factor analysis and correlations, if you want it.
|
200
200
|
* Dominance Analysis, with multivariate dependent and bootstrap (Azen & Budescu)
|
201
201
|
* Sample calculation related formulas
|
202
|
+
* Structural Equation Modeling (SEM), using R libraries +sem+ and +OpenMx+
|
202
203
|
* Creates reports on text, html and rtf, using ReportBuilder gem
|
203
204
|
email:
|
204
205
|
- clbustos@gmail.com
|
@@ -219,6 +220,7 @@ files:
|
|
219
220
|
- Rakefile
|
220
221
|
- bin/statsample
|
221
222
|
- data/crime.txt
|
223
|
+
- data/hartman_23.matrix
|
222
224
|
- data/locale/es/LC_MESSAGES/statsample.mo
|
223
225
|
- data/repeated_fields.csv
|
224
226
|
- data/test_binomial.csv
|
@@ -241,6 +243,7 @@ files:
|
|
241
243
|
- examples/tetrachoric.rb
|
242
244
|
- examples/u_test.rb
|
243
245
|
- examples/vector.rb
|
246
|
+
- examples/velicer_map_test.rb
|
244
247
|
- lib/distribution.rb
|
245
248
|
- lib/distribution/chisquare.rb
|
246
249
|
- lib/distribution/f.rb
|
@@ -265,6 +268,7 @@ files:
|
|
265
268
|
- lib/statsample/dominanceanalysis.rb
|
266
269
|
- lib/statsample/dominanceanalysis/bootstrap.rb
|
267
270
|
- lib/statsample/factor.rb
|
271
|
+
- lib/statsample/factor/map.rb
|
268
272
|
- lib/statsample/factor/parallelanalysis.rb
|
269
273
|
- lib/statsample/factor/pca.rb
|
270
274
|
- lib/statsample/factor/principalaxis.rb
|
@@ -301,6 +305,7 @@ files:
|
|
301
305
|
- lib/statsample/rserve_extension.rb
|
302
306
|
- lib/statsample/srs.rb
|
303
307
|
- lib/statsample/test.rb
|
308
|
+
- lib/statsample/test/chisquare.rb
|
304
309
|
- lib/statsample/test/f.rb
|
305
310
|
- lib/statsample/test/levene.rb
|
306
311
|
- lib/statsample/test/t.rb
|
metadata.gz.sig
CHANGED
Binary file
|