statsample 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +8 -0
- data/Manifest.txt +2 -0
- data/README.txt +13 -11
- data/data/locale/es/LC_MESSAGES/statsample.mo +0 -0
- data/examples/parallel_analysis_tetrachoric.rb +1 -0
- data/examples/reliability.rb +8 -0
- data/lib/statsample.rb +2 -1
- data/lib/statsample/factor/parallelanalysis.rb +111 -110
- data/lib/statsample/matrix.rb +5 -0
- data/lib/statsample/reliability.rb +9 -0
- data/lib/statsample/reliability/scaleanalysis.rb +20 -13
- data/lib/statsample/rserve_extension.rb +20 -0
- data/lib/statsample/vector.rb +10 -11
- data/po/es/statsample.mo +0 -0
- data/po/es/statsample.po +66 -74
- data/po/statsample.pot +15 -16
- data/test/test_reliability.rb +18 -2
- data/test/test_rserve_extension.rb +40 -0
- data/test/test_svg_graph.rb +1 -1
- metadata +9 -6
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 0.13.1 / 2010-07-03
|
2
|
+
|
3
|
+
* Rserve extensions for dataset and vector operational
|
4
|
+
* On x86_64, variance from gsl is not exactly equal to sum of variance-covariance on Statsample::Reliability::Scale, but in delta 1e-10
|
5
|
+
* Updated README.txt
|
6
|
+
* Reliability::ScaleAnalysis uses covariance matrix for 'if deleted' calculations to optimize memory and speed. Test for 'if deleted' statistics
|
7
|
+
* More string translated. Added dependency on tetrachoric on parallel analysis
|
8
|
+
|
1
9
|
=== 0.13.0 / 2010-06-13
|
2
10
|
|
3
11
|
* Polychoric and Tetrachoric moved to gem statsample-bivariate-extension
|
data/Manifest.txt
CHANGED
@@ -84,6 +84,7 @@ lib/statsample/reliability.rb
|
|
84
84
|
lib/statsample/reliability/multiscaleanalysis.rb
|
85
85
|
lib/statsample/reliability/scaleanalysis.rb
|
86
86
|
lib/statsample/resample.rb
|
87
|
+
lib/statsample/rserve_extension.rb
|
87
88
|
lib/statsample/srs.rb
|
88
89
|
lib/statsample/test.rb
|
89
90
|
lib/statsample/test/f.rb
|
@@ -121,6 +122,7 @@ test/test_permutation.rb
|
|
121
122
|
test/test_regression.rb
|
122
123
|
test/test_reliability.rb
|
123
124
|
test/test_resample.rb
|
125
|
+
test/test_rserve_extension.rb
|
124
126
|
test/test_srs.rb
|
125
127
|
test/test_statistics.rb
|
126
128
|
test/test_stest.rb
|
data/README.txt
CHANGED
@@ -10,12 +10,12 @@ A suite for basic and advanced statistics on Ruby. Tested on Ruby 1.8.7, 1.9.1,
|
|
10
10
|
Include:
|
11
11
|
* Descriptive statistics: frequencies, median, mean, standard error, skew, kurtosis (and many others).
|
12
12
|
* Imports and exports datasets from and to Excel, CSV and plain text files.
|
13
|
-
* Correlations: Pearson's r, Spearman's rank correlation (rho),
|
14
|
-
* Anova: generic and vector-based One-way ANOVA
|
13
|
+
* Correlations: Pearson's r, Spearman's rank correlation (rho), point biserial, tau a, tau b, gamma, Tetrachoric and Polychoric.
|
14
|
+
* Anova: generic and vector-based One-way ANOVA and Two-way ANOVA
|
15
15
|
* Tests: F, T, Levene, U-Mannwhitney.
|
16
16
|
* Regression: Simple, Multiple (OLS), Probit and Logit
|
17
17
|
* Factorial Analysis: Extraction (PCA and Principal Axis), Rotation (Varimax, Equimax, Quartimax) and Parallel Analysis, for estimation of number of factors.
|
18
|
-
* Reliability analysis for simple scale and
|
18
|
+
* Reliability analysis for simple scale and a DSL to easily analyze multiple scales using factor analysis and correlations, if you want it.
|
19
19
|
* Dominance Analysis, with multivariate dependent and bootstrap (Azen & Budescu)
|
20
20
|
* Sample calculation related formulas
|
21
21
|
* Creates reports on text, html and rtf, using ReportBuilder gem
|
@@ -42,7 +42,9 @@ Include:
|
|
42
42
|
* Statsample::Factor::Equimax
|
43
43
|
* Statsample::Factor::Quartimax
|
44
44
|
* Statsample::Factor::ParallelAnalysis performs Horn's 'parallel analysis' to a principal components analysis to adjust for sample bias in the retention of components.
|
45
|
-
* Dominance Analysis. Based on Budescu and Azen papers,
|
45
|
+
* Dominance Analysis. Based on Budescu and Azen papers, dominance analysis is a method to analyze the relative importance of one predictor relative to another on multiple regression
|
46
|
+
* Statsample::DominanceAnalysis class can report dominance analysis for a sample, using uni or multivariate dependent variables
|
47
|
+
* Statsample::DominanceAnalysis::Bootstrap can execute bootstrap analysis to determine dominance stability, as recomended by Azen & Budescu (2003) link[http://psycnet.apa.org/journals/met/8/2/129/].
|
46
48
|
* Module Statsample::Codification, to help to codify open questions
|
47
49
|
* Converters to import and export data:
|
48
50
|
* Statsample::Database : Can create sql to create tables, read and insert data
|
@@ -51,7 +53,7 @@ Include:
|
|
51
53
|
* Statsample::Mx : Write Mx Files
|
52
54
|
* Statsample::GGobi : Write Ggobi files
|
53
55
|
* Module Statsample::Crosstab provides function to create crosstab for categorical data
|
54
|
-
* Module Statsample::Reliability provides functions to analyze scales.
|
56
|
+
* Module Statsample::Reliability provides functions to analyze scales with psychometric methods.
|
55
57
|
* Class ScaleAnalysis provides statistics like mean, standard deviation for a scale, Cronbach's alpha and standarized Cronbach's alpha, and for each item: mean, correlation with total scale, mean if deleted, Cronbach's alpha is deleted.
|
56
58
|
* Class MultiScaleAnalysis provides a DSL to easily analyze reliability of multiple scales and retrieve correlation matrix and factor analysis of them.
|
57
59
|
* Module Statsample::SRS (Simple Random Sampling) provides a lot of functions to estimate standard error for several type of samples
|
@@ -60,8 +62,8 @@ Include:
|
|
60
62
|
* Statsample::Test::UMannWhitney
|
61
63
|
* Statsample::Test::T
|
62
64
|
* Statsample::Test::F
|
63
|
-
* Interfaces to gdchart, gnuplot and SVG::Graph
|
64
|
-
|
65
|
+
* Interfaces to gdchart, gnuplot and SVG::Graph (experimental)
|
66
|
+
* Close integration with gem <tt>reportbuilder</tt>, to easily create reports on text, html and rtf formats.
|
65
67
|
|
66
68
|
== Examples of use:
|
67
69
|
|
@@ -99,13 +101,13 @@ Optional:
|
|
99
101
|
|
100
102
|
On *nix, you should install statsample-optimization to retrieve gems gsl, statistics2 and a C extension to speed some methods.
|
101
103
|
|
102
|
-
|
103
|
-
|
104
|
-
To use it, on Ubuntu I recommend install build-essential and libgsl0-dev using apt-get and compile ruby 1.8 or 1.9 from source code.
|
104
|
+
There are available precompiled version for Ruby 1.9 on x86, x86_64 and mingw32 archs.
|
105
105
|
|
106
|
-
$sudo
|
106
|
+
$ sudo gem install statsample-optimization
|
107
107
|
|
108
|
+
If you use Ruby 1.8, you should compile statsample-optimization, usign parameter <tt>--platform ruby</tt>
|
108
109
|
|
110
|
+
$ sudo gem install statsample-optimization --platform ruby
|
109
111
|
|
110
112
|
Available setup.rb file
|
111
113
|
|
Binary file
|
data/examples/reliability.rb
CHANGED
@@ -10,3 +10,11 @@ end
|
|
10
10
|
ds.update_valid_data
|
11
11
|
rel=Statsample::Reliability::ScaleAnalysis.new(ds)
|
12
12
|
puts rel.summary
|
13
|
+
|
14
|
+
|
15
|
+
ms=Statsample::Reliability::MultiScaleAnalysis.new(:name=>"Multi Scale analyss") do |m|
|
16
|
+
m.scale "Scale 1", ds.clone(%w{v1 v2 v3 v4 v5 v6 v7 v8 v9 v10})
|
17
|
+
m.scale "Scale 2", ds.clone(%w{v11 v12 v13 v14 v15 v16 v17 v18 v19})
|
18
|
+
end
|
19
|
+
|
20
|
+
puts ms.summary
|
data/lib/statsample.rb
CHANGED
@@ -1,120 +1,121 @@
|
|
1
1
|
module Statsample
|
2
|
-
module Factor
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
total+=1 if (@original[i]>0 and @original[i]>ds_eigenvalues[f].percentil(percentil))
|
67
|
-
end
|
68
|
-
total
|
69
|
-
end
|
70
|
-
def report_building(g) #:nodoc:
|
71
|
-
g.section(:name=>@name) do |s|
|
72
|
-
s.text _("Bootstrap Method: %s") % bootstrap_method
|
73
|
-
s.text _("Correlation Matrix type : %s") % matrix_method
|
74
|
-
s.text _("Number of variables: %d") % @n_variables
|
75
|
-
s.text _("Number of cases: %d") % @n_cases
|
76
|
-
s.text _("Number of iterations: %d") % @iterations
|
77
|
-
s.text _("Number or factors to preserve: %d") % number_of_factors
|
78
|
-
s.table(:name=>_("Eigenvalues"), :header=>[_("Eigenvalue"), _("actual"), _("mean"),"p.#{percentil}",_("preserve?")]) do |t|
|
2
|
+
module Factor
|
3
|
+
# Performs Horn's 'parallel analysis' to a principal components analysis
|
4
|
+
# to adjust for sample bias in the retention of components.
|
5
|
+
# Can create the bootstrap samples using parameters (mean and standard
|
6
|
+
# deviation of each variable) or sampling for actual data.
|
7
|
+
# == Description
|
8
|
+
# "PA involves the construction of a number of correlation matrices of random variables based on the same sample size and number of variables in the real data set. The average eigenvalues from the random correlation matrices are then compared to the eigenvalues from the real data correlation matrix, such that the first observed eigenvalue is compared to the first random eigenvalue, the second observed eigenvalue is compared to the second random eigenvalue, and so on." (Hayton, Allen & Scarpello, 2004, p.194)
|
9
|
+
# == Usage
|
10
|
+
# # ds should be any valid dataset
|
11
|
+
# pa=Statsample::Factor::ParallelAnalysis.new(ds, :iterations=>100, :bootstrap_method=>:raw_data)
|
12
|
+
#
|
13
|
+
# == References:
|
14
|
+
# * Hayton, J., Allen, D. & Scarpello, V.(2004). Factor Retention Decisions in Exploratory Factor Analysis: a Tutorial on Parallel Analysis. <i>Organizational Research Methods, 7</i> (2), 191-205.
|
15
|
+
# * https://people.ok.ubc.ca/brioconn/nfactors/nfactors.html (for inspiration)
|
16
|
+
class ParallelAnalysis
|
17
|
+
|
18
|
+
include DirtyMemoize
|
19
|
+
include Summarizable
|
20
|
+
# Number of random sets to produce. 50 by default
|
21
|
+
attr_accessor :iterations
|
22
|
+
# Name of analysis
|
23
|
+
attr_accessor :name
|
24
|
+
# Dataset. You could use mock vectors when use bootstrap method
|
25
|
+
attr_reader :ds
|
26
|
+
# Bootstrap method. <tt>:raw_data</tt> used by default
|
27
|
+
# * <tt>:parameter</tt>: uses mean and standard deviation of each variable
|
28
|
+
# * <tt>:raw_data</tt> : sample with replacement from actual data.
|
29
|
+
#
|
30
|
+
attr_accessor :bootstrap_method
|
31
|
+
# Factor method.
|
32
|
+
# Could be Statsample::Factor::PCA or Statsample::Factor::PrincipalAxis.
|
33
|
+
# PCA used by default.
|
34
|
+
attr_accessor :factor_class
|
35
|
+
# Percentil over bootstrap eigenvalue should be accepted. 95 by default
|
36
|
+
attr_accessor :percentil
|
37
|
+
# Correlation matrix used with :raw_data . <tt>:correlation_matrix</tt> used by default
|
38
|
+
attr_accessor :matrix_method
|
39
|
+
# Dataset with bootstrapped eigenvalues
|
40
|
+
attr_reader :ds_eigenvalues
|
41
|
+
# Show extra information if true
|
42
|
+
attr_accessor :debug
|
43
|
+
|
44
|
+
|
45
|
+
def initialize(ds, opts=Hash.new)
|
46
|
+
@ds=ds
|
47
|
+
@fields=@ds.fields
|
48
|
+
@n_variables=@fields.size
|
49
|
+
@n_cases=ds.cases
|
50
|
+
opts_default={
|
51
|
+
:name=>_("Parallel Analysis"),
|
52
|
+
:iterations=>50,
|
53
|
+
:bootstrap_method => :raw_data,
|
54
|
+
:factor_class => Statsample::Factor::PCA,
|
55
|
+
:percentil=>95,
|
56
|
+
:debug=>false,
|
57
|
+
:matrix_method=>:correlation_matrix
|
58
|
+
}
|
59
|
+
@opts=opts_default.merge(opts)
|
60
|
+
@opts[:matrix_method]==:correlation_matrix if @opts[:bootstrap_method]==:parameters
|
61
|
+
opts_default.keys.each {|k| send("#{k}=", @opts[k]) }
|
62
|
+
end
|
63
|
+
# Number of factor to retent
|
64
|
+
def number_of_factors
|
65
|
+
total=0
|
79
66
|
ds_eigenvalues.fields.each_with_index do |f,i|
|
80
|
-
|
81
|
-
t.row [i+1, "%0.4f" % @original[i], "%0.4f" % v.mean, "%0.4f" % v.percentil(percentil), (v.percentil(percentil)>0 and @original[i] > v.percentil(percentil)) ? "Yes":""]
|
67
|
+
total+=1 if (@original[i]>0 and @original[i]>ds_eigenvalues[f].percentil(percentil))
|
82
68
|
end
|
69
|
+
total
|
83
70
|
end
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
71
|
+
def report_building(g) #:nodoc:
|
72
|
+
g.section(:name=>@name) do |s|
|
73
|
+
s.text _("Bootstrap Method: %s") % bootstrap_method
|
74
|
+
s.text _("Correlation Matrix type : %s") % matrix_method
|
75
|
+
s.text _("Number of variables: %d") % @n_variables
|
76
|
+
s.text _("Number of cases: %d") % @n_cases
|
77
|
+
s.text _("Number of iterations: %d") % @iterations
|
78
|
+
s.text _("Number or factors to preserve: %d") % number_of_factors
|
79
|
+
s.table(:name=>_("Eigenvalues"), :header=>[_("n"), _("data eigenvalue"), _("generated eigenvalue"),"p.#{percentil}",_("preserve?")]) do |t|
|
80
|
+
ds_eigenvalues.fields.each_with_index do |f,i|
|
81
|
+
v=ds_eigenvalues[f]
|
82
|
+
t.row [i+1, "%0.4f" % @original[i], "%0.4f" % v.mean, "%0.4f" % v.percentil(percentil), (v.percentil(percentil)>0 and @original[i] > v.percentil(percentil)) ? "Yes":""]
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
98
87
|
end
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
88
|
+
# Perform calculation. Shouldn't be called directly for the user
|
89
|
+
def compute
|
90
|
+
@original=factor_class.new(Statsample::Bivariate.correlation_matrix(@ds), :m=>@n_variables).eigenvalues.sort.reverse
|
91
|
+
@ds_eigenvalues=Statsample::Dataset.new((1..@n_variables).map{|v| "ev_%05d" % v})
|
92
|
+
@ds_eigenvalues.fields.each {|f| @ds_eigenvalues[f].type=:scale}
|
93
|
+
|
94
|
+
@iterations.times do |i|
|
95
|
+
# Create a dataset of dummy values
|
96
|
+
ds_bootstrap=Statsample::Dataset.new(@ds.fields)
|
97
|
+
if bootstrap_method==:parameter
|
98
|
+
rng = GSL::Rng.alloc()
|
99
|
+
end
|
100
|
+
@fields.each do |f|
|
101
|
+
|
102
|
+
if bootstrap_method==:parameter
|
103
|
+
sd=@ds[f].sd
|
104
|
+
mean=@ds[f].mean
|
105
|
+
ds_bootstrap[f]=@n_cases.times.map {|c| rng.gaussian(sd)+mean}.to_scale
|
106
|
+
elsif bootstrap_method==:raw_data
|
107
|
+
ds_bootstrap[f]=ds[f].sample_with_replacement(@n_cases).to_scale
|
108
|
+
end
|
109
|
+
end
|
110
|
+
fa=factor_class.new(Statsample::Bivariate.send(matrix_method, ds_bootstrap), :m=>@n_variables)
|
111
|
+
ev=fa.eigenvalues.sort.reverse
|
112
|
+
@ds_eigenvalues.add_case_array(ev)
|
113
|
+
puts "iteration #{i}" if $DEBUG or debug
|
107
114
|
end
|
115
|
+
@ds_eigenvalues.update_valid_data
|
108
116
|
end
|
109
|
-
|
110
|
-
|
111
|
-
@ds_eigenvalues.add_case_array(ev)
|
112
|
-
puts "iteration #{i}" if $DEBUG or debug
|
117
|
+
dirty_memoize :number_of_factors, :ds_eigenvalues
|
118
|
+
dirty_writer :iterations, :bootstrap_method, :factor_class, :percentil
|
113
119
|
end
|
114
|
-
@ds_eigenvalues.update_valid_data
|
115
120
|
end
|
116
|
-
dirty_memoize :number_of_factors, :ds_eigenvalues
|
117
|
-
dirty_writer :iterations, :bootstrap_method, :factor_class, :percentil
|
118
|
-
end
|
119
|
-
end
|
120
121
|
end
|
data/lib/statsample/matrix.rb
CHANGED
@@ -105,6 +105,11 @@ module Statsample
|
|
105
105
|
def name
|
106
106
|
@name||=get_new_name
|
107
107
|
end
|
108
|
+
# Get variance for field k
|
109
|
+
#
|
110
|
+
def variance(k)
|
111
|
+
submatrix([k])[0,0]
|
112
|
+
end
|
108
113
|
def get_new_name
|
109
114
|
@@covariatematrix+=1
|
110
115
|
_("Covariate matrix %d") % @@covariatematrix
|
@@ -21,9 +21,18 @@ module Statsample
|
|
21
21
|
}.to_dataset
|
22
22
|
cronbach_alpha(ds)
|
23
23
|
end
|
24
|
+
# Get Cronbach alpha from <tt>n</tt> cases,
|
25
|
+
# <tt>s2</tt> mean variance and <tt>cov</tt>
|
26
|
+
# mean covariance
|
24
27
|
def cronbach_alpha_from_n_s2_cov(n,s2,cov)
|
25
28
|
(n.quo(n-1)) * (1-(s2.quo(s2+(n-1)*cov)))
|
26
29
|
end
|
30
|
+
# Get Cronbach's alpha from a covariance matrix
|
31
|
+
def cronbach_alpha_from_covariance_matrix(cov)
|
32
|
+
n=cov.row_size
|
33
|
+
s2=n.times.inject(0) {|ac,i| ac+cov[i,i]}
|
34
|
+
(n.quo(n-1))*(1-(s2.quo(cov.total_sum)))
|
35
|
+
end
|
27
36
|
# Returns n necessary to obtain specific alpha
|
28
37
|
# given variance and covariance mean of items
|
29
38
|
def n_for_desired_alpha(alpha,s2,cov)
|
@@ -12,7 +12,7 @@ module Statsample
|
|
12
12
|
# puts ia.summary
|
13
13
|
class ScaleAnalysis
|
14
14
|
include Summarizable
|
15
|
-
attr_reader :ds,:mean, :sd,:valid_n, :alpha , :alpha_standarized, :variances_mean, :covariances_mean
|
15
|
+
attr_reader :ds,:mean, :sd,:valid_n, :alpha , :alpha_standarized, :variances_mean, :covariances_mean, :cov_m
|
16
16
|
attr_accessor :name
|
17
17
|
def initialize(ds, opts=Hash.new)
|
18
18
|
@ds=ds.dup_only_valid
|
@@ -29,8 +29,9 @@ module Statsample
|
|
29
29
|
opts_default={:name=>"Reliability Analisis"}
|
30
30
|
@opts=opts_default.merge(opts)
|
31
31
|
@name=@opts[:name]
|
32
|
+
@cov_m=Statsample::Bivariate.covariance_matrix(@ds)
|
32
33
|
# Mean for covariances and variances
|
33
|
-
@variances=@
|
34
|
+
@variances=@k.times.map {|i| @cov_m[i,i]}.to_scale
|
34
35
|
@variances_mean=@variances.mean
|
35
36
|
@covariances_mean=(@variance-@variances.sum).quo(@k**2-@k)
|
36
37
|
begin
|
@@ -125,10 +126,10 @@ module Statsample
|
|
125
126
|
end
|
126
127
|
end
|
127
128
|
def item_statistics
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
129
|
+
@is||=@ds.fields.inject({}) do |a,v|
|
130
|
+
a[v]={:mean=>@ds[v].mean, :sds=>Math::sqrt(@cov_m.variance(v))}
|
131
|
+
a
|
132
|
+
end
|
132
133
|
end
|
133
134
|
# Returns a dataset with cases ordered by score
|
134
135
|
# and variables ordered by difficulty
|
@@ -152,15 +153,21 @@ module Statsample
|
|
152
153
|
ds_new
|
153
154
|
end
|
154
155
|
def stats_if_deleted
|
156
|
+
@sif||=stats_if_deleted_intern
|
157
|
+
end
|
158
|
+
def stats_if_deleted_intern # :nodoc:
|
159
|
+
|
155
160
|
@ds.fields.inject({}) do |a,v|
|
156
|
-
|
157
|
-
ds2.
|
158
|
-
|
161
|
+
cov_2=@cov_m.submatrix(@ds.fields-[v])
|
162
|
+
#ds2=@ds.clone
|
163
|
+
#ds2.delete_vector(v)
|
164
|
+
#total=ds2.vector_sum
|
159
165
|
a[v]={}
|
160
|
-
a[v][:mean]=total.mean
|
161
|
-
a[v][:
|
162
|
-
a[v][:variance_sample]=
|
163
|
-
a[v][:
|
166
|
+
#a[v][:mean]=total.mean
|
167
|
+
a[v][:mean]=@mean-item_statistics[v][:mean]
|
168
|
+
a[v][:variance_sample]=cov_2.total_sum
|
169
|
+
a[v][:sds]=Math::sqrt(a[v][:variance_sample])
|
170
|
+
a[v][:alpha]=Statsample::Reliability.cronbach_alpha_from_covariance_matrix(cov_2)
|
164
171
|
a
|
165
172
|
end
|
166
173
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Several additions to Statsample objects, to support
|
2
|
+
# rserve-client
|
3
|
+
|
4
|
+
module Statsample
|
5
|
+
class Vector
|
6
|
+
def to_REXP
|
7
|
+
Rserve::REXP::Wrapper.wrap(data_with_nils)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
class Dataset
|
11
|
+
def to_REXP
|
12
|
+
names=@fields
|
13
|
+
data=@fields.map {|f|
|
14
|
+
Rserve::REXP::Wrapper.wrap(@vectors[f].data_with_nils)
|
15
|
+
}
|
16
|
+
l=Rserve::Rlist.new(data,names)
|
17
|
+
Rserve::REXP.create_data_frame(l)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/statsample/vector.rb
CHANGED
@@ -229,15 +229,14 @@ module Statsample
|
|
229
229
|
set_scale_data if(@type==:scale)
|
230
230
|
set_date_data if(@type==:date)
|
231
231
|
end
|
232
|
-
|
233
232
|
if Statsample::STATSAMPLE__.respond_to?(:set_valid_data_intern)
|
234
|
-
|
235
|
-
|
236
|
-
|
233
|
+
def set_valid_data_intern #:nodoc:
|
234
|
+
Statsample::STATSAMPLE__.set_valid_data_intern(self)
|
235
|
+
end
|
237
236
|
else
|
238
|
-
|
239
|
-
|
240
|
-
|
237
|
+
def set_valid_data_intern #:nodoc:
|
238
|
+
_set_valid_data_intern
|
239
|
+
end
|
241
240
|
end
|
242
241
|
def _set_valid_data_intern #:nodoc:
|
243
242
|
@data.each do |n|
|
@@ -274,22 +273,22 @@ module Statsample
|
|
274
273
|
end
|
275
274
|
# Size of total data
|
276
275
|
def size
|
277
|
-
|
276
|
+
@data.size
|
278
277
|
end
|
279
278
|
alias_method :n, :size
|
280
279
|
|
281
280
|
# Retrieves i element of data
|
282
281
|
def [](i)
|
283
|
-
|
282
|
+
@data[i]
|
284
283
|
end
|
285
284
|
# Set i element of data.
|
286
285
|
# Note: Use set_valid_data if you include missing values
|
287
286
|
def []=(i,v)
|
288
|
-
|
287
|
+
@data[i]=v
|
289
288
|
end
|
290
289
|
# Return true if a value is valid (not nil and not included on missing values)
|
291
290
|
def is_valid?(x)
|
292
|
-
|
291
|
+
!(x.nil? or @missing_values.include? x)
|
293
292
|
end
|
294
293
|
# Set missing_values.
|
295
294
|
# if update_valid = false, you should use
|
data/po/es/statsample.mo
CHANGED
Binary file
|
data/po/es/statsample.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
msgid ""
|
2
2
|
msgstr ""
|
3
3
|
"Project-Id-Version: statsample 0.13.0\n"
|
4
|
-
"POT-Creation-Date: 2010-06-21
|
5
|
-
"PO-Revision-Date: 2010-06-21
|
4
|
+
"POT-Creation-Date: 2010-06-21 16:08-0400\n"
|
5
|
+
"PO-Revision-Date: 2010-06-21 16:08-0300\n"
|
6
6
|
"Last-Translator: Claudio Bustos <clbustos@gmail.com>\n"
|
7
7
|
"Language-Team: Desarrollador\n"
|
8
8
|
"MIME-Version: 1.0\n"
|
@@ -19,10 +19,8 @@ msgstr "Prueba F"
|
|
19
19
|
msgid "Mean and standard deviation"
|
20
20
|
msgstr "Promedio y desviación estándar"
|
21
21
|
|
22
|
-
#: lib/statsample/test/t.rb:209
|
23
|
-
#: lib/statsample/factor/pca.rb:
|
24
|
-
#: lib/statsample/factor/pca.rb:149
|
25
|
-
#: lib/statsample/factor/pca.rb:155
|
22
|
+
#: lib/statsample/test/t.rb:209 lib/statsample/factor/pca.rb:144
|
23
|
+
#: lib/statsample/factor/pca.rb:149 lib/statsample/factor/pca.rb:155
|
26
24
|
#: lib/statsample/factor/principalaxis.rb:180
|
27
25
|
#: lib/statsample/factor/principalaxis.rb:185
|
28
26
|
msgid "Variable"
|
@@ -30,7 +28,6 @@ msgstr "Variable"
|
|
30
28
|
|
31
29
|
#: lib/statsample/test/t.rb:209
|
32
30
|
#: lib/statsample/dominanceanalysis/bootstrap.rb:208
|
33
|
-
#: lib/statsample/factor/parallelanalysis.rb:78
|
34
31
|
msgid "mean"
|
35
32
|
msgstr "promedio"
|
36
33
|
|
@@ -38,7 +35,7 @@ msgstr "promedio"
|
|
38
35
|
msgid "sd"
|
39
36
|
msgstr "de"
|
40
37
|
|
41
|
-
#: lib/statsample/test/t.rb:209
|
38
|
+
#: lib/statsample/test/t.rb:209 lib/statsample/factor/parallelanalysis.rb:79
|
42
39
|
msgid "n"
|
43
40
|
msgstr "n"
|
44
41
|
|
@@ -219,17 +216,13 @@ msgstr "B"
|
|
219
216
|
msgid "Within"
|
220
217
|
msgstr "Dentro"
|
221
218
|
|
222
|
-
#: lib/statsample/anova/twoway.rb:98
|
223
|
-
#: lib/statsample/anova/oneway.rb:57
|
219
|
+
#: lib/statsample/anova/twoway.rb:98 lib/statsample/anova/oneway.rb:57
|
224
220
|
msgid "%s Table"
|
225
221
|
msgstr "Tabla %s"
|
226
222
|
|
227
|
-
#: lib/statsample/anova/twoway.rb:103
|
228
|
-
#: lib/statsample/
|
229
|
-
#: lib/statsample/crosstab.rb:
|
230
|
-
#: lib/statsample/crosstab.rb:116
|
231
|
-
#: lib/statsample/crosstab.rb:151
|
232
|
-
#: lib/statsample/crosstab.rb:173
|
223
|
+
#: lib/statsample/anova/twoway.rb:103 lib/statsample/anova/oneway.rb:60
|
224
|
+
#: lib/statsample/crosstab.rb:101 lib/statsample/crosstab.rb:116
|
225
|
+
#: lib/statsample/crosstab.rb:151 lib/statsample/crosstab.rb:173
|
233
226
|
#: lib/statsample/dominanceanalysis.rb:353
|
234
227
|
msgid "Total"
|
235
228
|
msgstr "Total"
|
@@ -238,13 +231,11 @@ msgstr "Total"
|
|
238
231
|
msgid "Anova Two-Way on %s"
|
239
232
|
msgstr "Anova de dos vías en %s"
|
240
233
|
|
241
|
-
#: lib/statsample/anova/twoway.rb:190
|
242
|
-
#: lib/statsample/anova/oneway.rb:101
|
234
|
+
#: lib/statsample/anova/twoway.rb:190 lib/statsample/anova/oneway.rb:101
|
243
235
|
msgid "Test of Homogeneity of variances (Levene)"
|
244
236
|
msgstr "Test de homogeneidad de varianza (Levene)"
|
245
237
|
|
246
|
-
#: lib/statsample/anova/twoway.rb:195
|
247
|
-
#: lib/statsample/anova/twoway.rb:199
|
238
|
+
#: lib/statsample/anova/twoway.rb:195 lib/statsample/anova/twoway.rb:199
|
248
239
|
msgid "%s Mean"
|
249
240
|
msgstr "Promedio %s"
|
250
241
|
|
@@ -273,9 +264,8 @@ msgid "Descriptives"
|
|
273
264
|
msgstr "Descriptivos"
|
274
265
|
|
275
266
|
#: lib/statsample/bivariate/pearson.rb:33
|
276
|
-
#, fuzzy
|
277
267
|
msgid "Correlation (%s - %s)"
|
278
|
-
msgstr "
|
268
|
+
msgstr "Correlación (%s - %s)"
|
279
269
|
|
280
270
|
#: lib/statsample/bivariate/pearson.rb:51
|
281
271
|
msgid "%s : r=%0.3f (t:%0.3f, g.l.=%d, p:%0.3f / %s tails)"
|
@@ -285,54 +275,48 @@ msgstr "%s : r=%0.3f (t:%0.3f, g.l.=%d, p:%0.3f / %s colas)"
|
|
285
275
|
msgid "Histogram %s"
|
286
276
|
msgstr "Histograma: %s"
|
287
277
|
|
288
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
289
|
-
#, fuzzy
|
278
|
+
#: lib/statsample/factor/parallelanalysis.rb:51
|
290
279
|
msgid "Parallel Analysis"
|
291
|
-
msgstr "Análisis
|
280
|
+
msgstr "Análisis Paralelo"
|
292
281
|
|
293
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
294
|
-
#, fuzzy
|
282
|
+
#: lib/statsample/factor/parallelanalysis.rb:73
|
295
283
|
msgid "Bootstrap Method: %s"
|
296
|
-
msgstr "
|
284
|
+
msgstr "Método de Remuestreo: %s"
|
297
285
|
|
298
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
299
|
-
#, fuzzy
|
286
|
+
#: lib/statsample/factor/parallelanalysis.rb:74
|
300
287
|
msgid "Correlation Matrix type : %s"
|
301
|
-
msgstr "
|
288
|
+
msgstr "Tipo de matriz de correlacion : %s"
|
302
289
|
|
303
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
290
|
+
#: lib/statsample/factor/parallelanalysis.rb:75
|
304
291
|
msgid "Number of variables: %d"
|
305
292
|
msgstr "Número de variables: %d"
|
306
293
|
|
307
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
294
|
+
#: lib/statsample/factor/parallelanalysis.rb:76
|
308
295
|
msgid "Number of cases: %d"
|
309
296
|
msgstr "Número de casos: %d"
|
310
297
|
|
311
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
312
|
-
#, fuzzy
|
298
|
+
#: lib/statsample/factor/parallelanalysis.rb:77
|
313
299
|
msgid "Number of iterations: %d"
|
314
|
-
msgstr "
|
300
|
+
msgstr "Número de iteraciones: %d"
|
315
301
|
|
316
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
302
|
+
#: lib/statsample/factor/parallelanalysis.rb:78
|
317
303
|
msgid "Number or factors to preserve: %d"
|
318
304
|
msgstr "Número de factores a preservar: %d"
|
319
305
|
|
320
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
321
|
-
#: lib/statsample/factor/pca.rb:149
|
322
|
-
#: lib/statsample/factor/principalaxis.rb:185
|
306
|
+
#: lib/statsample/factor/parallelanalysis.rb:79
|
307
|
+
#: lib/statsample/factor/pca.rb:149 lib/statsample/factor/principalaxis.rb:185
|
323
308
|
msgid "Eigenvalues"
|
324
309
|
msgstr "Eigenvalues"
|
325
310
|
|
326
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
327
|
-
|
328
|
-
|
329
|
-
msgstr "Eigenvalues"
|
311
|
+
#: lib/statsample/factor/parallelanalysis.rb:79
|
312
|
+
msgid "data eigenvalue"
|
313
|
+
msgstr "eigenvalue de los datos"
|
330
314
|
|
331
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
332
|
-
msgid "
|
333
|
-
msgstr "
|
315
|
+
#: lib/statsample/factor/parallelanalysis.rb:79
|
316
|
+
msgid "generated eigenvalue"
|
317
|
+
msgstr "eigenvalue generado"
|
334
318
|
|
335
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
319
|
+
#: lib/statsample/factor/parallelanalysis.rb:79
|
336
320
|
msgid "preserve?"
|
337
321
|
msgstr "¿preservar?"
|
338
322
|
|
@@ -340,36 +324,27 @@ msgstr "¿preservar?"
|
|
340
324
|
msgid "Principal Component Analysis"
|
341
325
|
msgstr "Análisis de componentes principales"
|
342
326
|
|
343
|
-
#: lib/statsample/factor/pca.rb:143
|
344
|
-
#: lib/statsample/factor/principalaxis.rb:178
|
327
|
+
#: lib/statsample/factor/pca.rb:143 lib/statsample/factor/principalaxis.rb:178
|
345
328
|
msgid "Number of factors: %d"
|
346
329
|
msgstr "Número de factores: %d"
|
347
330
|
|
348
|
-
#: lib/statsample/factor/pca.rb:144
|
349
|
-
#: lib/statsample/factor/principalaxis.rb:180
|
331
|
+
#: lib/statsample/factor/pca.rb:144 lib/statsample/factor/principalaxis.rb:180
|
350
332
|
msgid "Communalities"
|
351
333
|
msgstr "Comunalidades"
|
352
334
|
|
353
|
-
#: lib/statsample/factor/pca.rb:144
|
354
|
-
#: lib/statsample/factor/principalaxis.rb:180
|
355
|
-
#, fuzzy
|
335
|
+
#: lib/statsample/factor/pca.rb:144 lib/statsample/factor/principalaxis.rb:180
|
356
336
|
msgid "Initial"
|
357
|
-
msgstr "
|
337
|
+
msgstr "Inicial"
|
358
338
|
|
359
|
-
#: lib/statsample/factor/pca.rb:144
|
360
|
-
#: lib/statsample/factor/principalaxis.rb:180
|
361
|
-
#, fuzzy
|
339
|
+
#: lib/statsample/factor/pca.rb:144 lib/statsample/factor/principalaxis.rb:180
|
362
340
|
msgid "Extraction"
|
363
|
-
msgstr "
|
341
|
+
msgstr "Extracción"
|
364
342
|
|
365
|
-
#: lib/statsample/factor/pca.rb:149
|
366
|
-
#: lib/statsample/factor/principalaxis.rb:185
|
367
|
-
#, fuzzy
|
343
|
+
#: lib/statsample/factor/pca.rb:149 lib/statsample/factor/principalaxis.rb:185
|
368
344
|
msgid "Value"
|
369
345
|
msgstr "Valor de U"
|
370
346
|
|
371
|
-
#: lib/statsample/factor/pca.rb:155
|
372
|
-
#: lib/statsample/factor/principalaxis.rb:190
|
347
|
+
#: lib/statsample/factor/pca.rb:155 lib/statsample/factor/principalaxis.rb:190
|
373
348
|
msgid "Component Matrix"
|
374
349
|
msgstr "Matriz de componentes"
|
375
350
|
|
@@ -550,24 +525,20 @@ msgid "Y%d"
|
|
550
525
|
msgstr "Y%d"
|
551
526
|
|
552
527
|
#: lib/statsample/matrix.rb:110
|
553
|
-
#, fuzzy
|
554
528
|
msgid "Covariate matrix %d"
|
555
|
-
msgstr "Matriz de
|
529
|
+
msgstr "Matriz de Covarianza %d"
|
556
530
|
|
557
531
|
#: lib/statsample/matrix.rb:152
|
558
|
-
#, fuzzy
|
559
532
|
msgid "Correlation"
|
560
|
-
msgstr "
|
533
|
+
msgstr "Correlación"
|
561
534
|
|
562
535
|
#: lib/statsample/matrix.rb:152
|
563
|
-
#, fuzzy
|
564
536
|
msgid "Covariance"
|
565
|
-
msgstr "
|
537
|
+
msgstr "Covarianza"
|
566
538
|
|
567
539
|
#: lib/statsample/matrix.rb:152
|
568
|
-
#, fuzzy
|
569
540
|
msgid " Matrix"
|
570
|
-
msgstr "Matriz
|
541
|
+
msgstr "Matriz"
|
571
542
|
|
572
543
|
#: lib/statsample/vector.rb:614
|
573
544
|
msgid "n :%d"
|
@@ -609,14 +580,21 @@ msgstr "Dataset %d"
|
|
609
580
|
msgid "Cases: %d"
|
610
581
|
msgstr "Casos: %s"
|
611
582
|
|
583
|
+
#~ msgid "actual"
|
584
|
+
#~ msgstr "real"
|
585
|
+
|
612
586
|
#~ msgid "Polychoric correlation"
|
613
587
|
#~ msgstr "Correlación policórica"
|
588
|
+
|
614
589
|
#~ msgid "Minimizing using GSL Brent method\n"
|
615
590
|
#~ msgstr "Minimizando usando método GSL Brent\n"
|
591
|
+
|
616
592
|
#~ msgid "Two step minimization using %s method\n"
|
617
593
|
#~ msgstr "Minimización en dos etapas usando método %s\n"
|
594
|
+
|
618
595
|
#~ msgid "Contingence Table"
|
619
596
|
#~ msgstr "Tabla de Contingencia"
|
597
|
+
|
620
598
|
#~ msgid "Thresholds"
|
621
599
|
#~ msgstr "Umbrales"
|
622
600
|
|
@@ -627,34 +605,48 @@ msgstr "Casos: %s"
|
|
627
605
|
#, fuzzy
|
628
606
|
#~ msgid "Threshold Y %d"
|
629
607
|
#~ msgstr "Umbral Y:%0.3f"
|
608
|
+
|
630
609
|
#~ msgid "Test of bivariate normality: X2 = %0.3f, df = %d, p= %0.5f"
|
631
610
|
#~ msgstr "Prueba de normalidad bivariada: X2 = %0.3f, g.l. = %d, p= %0.5f"
|
611
|
+
|
632
612
|
#~ msgid "SE: %0.3f"
|
633
613
|
#~ msgstr "EE: %0.3f"
|
614
|
+
|
634
615
|
#~ msgid "Threshold X: %0.3f "
|
635
616
|
#~ msgstr "Umbral X: %0.3f"
|
617
|
+
|
636
618
|
#~ msgid "Threshold Y: %0.3f "
|
637
619
|
#~ msgstr "Umbral Y:%0.3f"
|
620
|
+
|
638
621
|
#~ msgid "Tetrachoric correlation"
|
639
622
|
#~ msgstr "Correlación tetracórica"
|
623
|
+
|
640
624
|
#~ msgid "Factor Analysis: "
|
641
625
|
#~ msgstr "Análisis de Factores:"
|
626
|
+
|
642
627
|
#~ msgid "DAB: "
|
643
628
|
#~ msgstr "RAD:"
|
629
|
+
|
644
630
|
#~ msgid "Total mean"
|
645
631
|
#~ msgstr "Promedio total"
|
632
|
+
|
646
633
|
#~ msgid "Total sd"
|
647
634
|
#~ msgstr "d.e. total"
|
635
|
+
|
648
636
|
#~ msgid "Total variance"
|
649
637
|
#~ msgstr "Varianza Total"
|
638
|
+
|
650
639
|
#~ msgid "Median"
|
651
640
|
#~ msgstr "Mediana"
|
641
|
+
|
652
642
|
#~ msgid "\"Anova Two-Way on #{@ds[dep_var].name}\""
|
653
643
|
#~ msgstr "\"Anova de dos vías en #{@ds[dep_var].name}\""
|
644
|
+
|
654
645
|
#~ msgid "Crosstab"
|
655
646
|
#~ msgstr "Tabulación cruzada"
|
647
|
+
|
656
648
|
#~ msgid "Crosstab: "
|
657
649
|
#~ msgstr "Tabulación cruzada:"
|
650
|
+
|
658
651
|
#~ msgid ")}"
|
659
652
|
#~ msgstr ")}"
|
660
|
-
|
data/po/statsample.pot
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
9
|
"Project-Id-Version: statsample 0.13.0\n"
|
10
|
-
"POT-Creation-Date: 2010-06-21
|
10
|
+
"POT-Creation-Date: 2010-06-21 16:08-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"
|
@@ -33,7 +33,6 @@ msgstr ""
|
|
33
33
|
|
34
34
|
#: lib/statsample/test/t.rb:209
|
35
35
|
#: lib/statsample/dominanceanalysis/bootstrap.rb:208
|
36
|
-
#: lib/statsample/factor/parallelanalysis.rb:78
|
37
36
|
msgid "mean"
|
38
37
|
msgstr ""
|
39
38
|
|
@@ -41,7 +40,7 @@ msgstr ""
|
|
41
40
|
msgid "sd"
|
42
41
|
msgstr ""
|
43
42
|
|
44
|
-
#: lib/statsample/test/t.rb:209
|
43
|
+
#: lib/statsample/test/t.rb:209 lib/statsample/factor/parallelanalysis.rb:79
|
45
44
|
msgid "n"
|
46
45
|
msgstr ""
|
47
46
|
|
@@ -281,48 +280,48 @@ msgstr ""
|
|
281
280
|
msgid "Histogram %s"
|
282
281
|
msgstr ""
|
283
282
|
|
284
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
283
|
+
#: lib/statsample/factor/parallelanalysis.rb:51
|
285
284
|
msgid "Parallel Analysis"
|
286
285
|
msgstr ""
|
287
286
|
|
288
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
287
|
+
#: lib/statsample/factor/parallelanalysis.rb:73
|
289
288
|
msgid "Bootstrap Method: %s"
|
290
289
|
msgstr ""
|
291
290
|
|
292
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
291
|
+
#: lib/statsample/factor/parallelanalysis.rb:74
|
293
292
|
msgid "Correlation Matrix type : %s"
|
294
293
|
msgstr ""
|
295
294
|
|
296
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
295
|
+
#: lib/statsample/factor/parallelanalysis.rb:75
|
297
296
|
msgid "Number of variables: %d"
|
298
297
|
msgstr ""
|
299
298
|
|
300
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
299
|
+
#: lib/statsample/factor/parallelanalysis.rb:76
|
301
300
|
msgid "Number of cases: %d"
|
302
301
|
msgstr ""
|
303
302
|
|
304
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
303
|
+
#: lib/statsample/factor/parallelanalysis.rb:77
|
305
304
|
msgid "Number of iterations: %d"
|
306
305
|
msgstr ""
|
307
306
|
|
308
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
307
|
+
#: lib/statsample/factor/parallelanalysis.rb:78
|
309
308
|
msgid "Number or factors to preserve: %d"
|
310
309
|
msgstr ""
|
311
310
|
|
312
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
311
|
+
#: lib/statsample/factor/parallelanalysis.rb:79
|
313
312
|
#: lib/statsample/factor/pca.rb:149 lib/statsample/factor/principalaxis.rb:185
|
314
313
|
msgid "Eigenvalues"
|
315
314
|
msgstr ""
|
316
315
|
|
317
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
318
|
-
msgid "
|
316
|
+
#: lib/statsample/factor/parallelanalysis.rb:79
|
317
|
+
msgid "data eigenvalue"
|
319
318
|
msgstr ""
|
320
319
|
|
321
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
322
|
-
msgid "
|
320
|
+
#: lib/statsample/factor/parallelanalysis.rb:79
|
321
|
+
msgid "generated eigenvalue"
|
323
322
|
msgstr ""
|
324
323
|
|
325
|
-
#: lib/statsample/factor/parallelanalysis.rb:
|
324
|
+
#: lib/statsample/factor/parallelanalysis.rb:79
|
326
325
|
msgid "preserve?"
|
327
326
|
msgstr ""
|
328
327
|
|
data/test/test_reliability.rb
CHANGED
@@ -33,6 +33,10 @@ class StatsampleReliabilityTestCase < MiniTest::Unit::TestCase
|
|
33
33
|
vm, cm = sa.variances_mean, sa.covariances_mean
|
34
34
|
assert_in_delta(sa.alpha, Statsample::Reliability.cronbach_alpha_from_n_s2_cov(@n_variables, vm,cm), 1e-10)
|
35
35
|
end
|
36
|
+
should "method cronbach_alpha_from_covariance_matrix returns correct value" do
|
37
|
+
cov=Statsample::Bivariate.covariance_matrix(@ds)
|
38
|
+
assert_in_delta(@a, Statsample::Reliability.cronbach_alpha_from_covariance_matrix(cov),0.0000001)
|
39
|
+
end
|
36
40
|
should "return correct n for desired alpha, covariance and variance" do
|
37
41
|
sa=Statsample::Reliability::ScaleAnalysis.new(@ds)
|
38
42
|
vm, cm = sa.variances_mean, sa.covariances_mean
|
@@ -102,7 +106,7 @@ class StatsampleReliabilityTestCase < MiniTest::Unit::TestCase
|
|
102
106
|
|
103
107
|
setup do
|
104
108
|
size=100
|
105
|
-
@scales=
|
109
|
+
@scales=3
|
106
110
|
@items_per_scale=10
|
107
111
|
h={}
|
108
112
|
@scales.times {|s|
|
@@ -173,13 +177,25 @@ class StatsampleReliabilityTestCase < MiniTest::Unit::TestCase
|
|
173
177
|
@x4=[1,2,3,4,4,4,4,3,4,4,5,30].to_scale
|
174
178
|
@ds={'x1'=>@x1,'x2'=>@x2,'x3'=>@x3,'x4'=>@x4}.to_dataset
|
175
179
|
@ia=Statsample::Reliability::ScaleAnalysis.new(@ds)
|
176
|
-
@cov_matrix
|
180
|
+
@cov_matrix=@ia.cov_m
|
177
181
|
end
|
178
182
|
should "return correct values for item analysis" do
|
179
183
|
assert_in_delta(0.980,@ia.alpha,0.001)
|
180
184
|
assert_in_delta(0.999,@ia.alpha_standarized,0.001)
|
181
185
|
var_mean=4.times.map{|m| @cov_matrix[m,m]}.to_scale.mean
|
182
186
|
assert_in_delta(var_mean, @ia.variances_mean)
|
187
|
+
assert_equal(@x1.mean, @ia.item_statistics['x1'][:mean])
|
188
|
+
assert_equal(@x4.mean, @ia.item_statistics['x4'][:mean])
|
189
|
+
assert_equal(@x1.sds, @ia.item_statistics['x1'][:sds])
|
190
|
+
assert_equal(@x4.sds, @ia.item_statistics['x4'][:sds])
|
191
|
+
ds2=@ds.clone
|
192
|
+
ds2.delete_vector('x1')
|
193
|
+
vector_sum=ds2.vector_sum
|
194
|
+
assert_equal(vector_sum.mean, @ia.stats_if_deleted['x1'][:mean])
|
195
|
+
assert_equal(vector_sum.sds, @ia.stats_if_deleted['x1'][:sds])
|
196
|
+
assert_in_delta(vector_sum.variance, @ia.stats_if_deleted['x1'][:variance_sample],1e-10)
|
197
|
+
|
198
|
+
assert_equal(Statsample::Reliability.cronbach_alpha(ds2), @ia.stats_if_deleted['x1'][:alpha])
|
183
199
|
|
184
200
|
covariances=[]
|
185
201
|
4.times.each {|i|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require(File.dirname(__FILE__)+'/helpers_tests.rb')
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rserve'
|
5
|
+
require 'statsample/rserve_extension'
|
6
|
+
|
7
|
+
class StatsampleRserveExtensionTestCase < MiniTest::Unit::TestCase
|
8
|
+
context "Statsample Rserve extensions" do
|
9
|
+
setup do
|
10
|
+
@r=Rserve::Connection.new
|
11
|
+
end
|
12
|
+
should "return a valid rexp for numeric vector" do
|
13
|
+
a=100.times.map {|i| rand()>0.9 ? nil : i+rand() }.to_scale
|
14
|
+
rexp=a.to_REXP
|
15
|
+
assert_instance_of(rexp, Rserve::REXP::Double)
|
16
|
+
assert_equal(rexp.to_ruby,a.data_with_nils)
|
17
|
+
@r.assign 'a',rexp
|
18
|
+
assert_equal(a.data_with_nils, @r.eval('a').to_ruby)
|
19
|
+
end
|
20
|
+
should "return a valid rserve dataframe for statsample datasets" do
|
21
|
+
a=100.times.map {|i| rand()>0.9 ? nil : i+rand() }.to_scale
|
22
|
+
b=100.times.map {|i| rand()>0.9 ? nil : i+rand() }.to_scale
|
23
|
+
c=100.times.map {|i| rand()>0.9 ? nil : i+rand() }.to_scale
|
24
|
+
ds={'a'=>a,'b'=>b,'c'=>c}.to_dataset
|
25
|
+
rexp=ds.to_REXP
|
26
|
+
assert_instance_of(rexp, Rserve::REXP::GenericVector)
|
27
|
+
ret=rexp.to_ruby
|
28
|
+
assert_equal(a.data_with_nils, ret['a'])
|
29
|
+
@r.assign 'df', rexp
|
30
|
+
out_df=@r.eval('df').to_ruby
|
31
|
+
assert_equal('data.frame', out_df.attributes['class'])
|
32
|
+
assert_equal(['a','b','c'], out_df.attributes['names'])
|
33
|
+
assert_equal(a.data_with_nils, out_df['a'])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
rescue LoadError
|
39
|
+
puts "Require rserve extension"
|
40
|
+
end
|
data/test/test_svg_graph.rb
CHANGED
@@ -46,7 +46,7 @@ class StatsampleSvgGraphTestCase < MiniTest::Unit::TestCase
|
|
46
46
|
File.open(file,"wb") {|fp|
|
47
47
|
fp.write(hist.burn)
|
48
48
|
}
|
49
|
-
assert(File.exists?(file))
|
49
|
+
#assert(File.exists?(file))
|
50
50
|
else
|
51
51
|
skip "Statsample::Vector#svggraph_histogram.new not tested (no ruby-gsl)"
|
52
52
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 13
|
8
|
-
-
|
9
|
-
version: 0.13.
|
8
|
+
- 1
|
9
|
+
version: 0.13.1
|
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-07-03 00:00:00 -04:00
|
39
39
|
default_executable:
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -191,12 +191,12 @@ 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),
|
195
|
-
* Anova: generic and vector-based One-way ANOVA
|
194
|
+
* Correlations: Pearson's r, Spearman's rank correlation (rho), point biserial, tau a, tau b, gamma, Tetrachoric and Polychoric.
|
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
198
|
* Factorial Analysis: Extraction (PCA and Principal Axis), Rotation (Varimax, Equimax, Quartimax) and Parallel Analysis, for estimation of number of factors.
|
199
|
-
* Reliability analysis for simple scale and
|
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
202
|
* Creates reports on text, html and rtf, using ReportBuilder gem
|
@@ -298,6 +298,7 @@ files:
|
|
298
298
|
- lib/statsample/reliability/multiscaleanalysis.rb
|
299
299
|
- lib/statsample/reliability/scaleanalysis.rb
|
300
300
|
- lib/statsample/resample.rb
|
301
|
+
- lib/statsample/rserve_extension.rb
|
301
302
|
- lib/statsample/srs.rb
|
302
303
|
- lib/statsample/test.rb
|
303
304
|
- lib/statsample/test/f.rb
|
@@ -335,6 +336,7 @@ files:
|
|
335
336
|
- test/test_regression.rb
|
336
337
|
- test/test_reliability.rb
|
337
338
|
- test/test_resample.rb
|
339
|
+
- test/test_rserve_extension.rb
|
338
340
|
- test/test_srs.rb
|
339
341
|
- test/test_statistics.rb
|
340
342
|
- test/test_stest.rb
|
@@ -407,6 +409,7 @@ test_files:
|
|
407
409
|
- test/test_crosstab.rb
|
408
410
|
- test/test_distribution.rb
|
409
411
|
- test/test_svg_graph.rb
|
412
|
+
- test/test_rserve_extension.rb
|
410
413
|
- test/test_csv.rb
|
411
414
|
- test/test_matrix.rb
|
412
415
|
- test/test_gsl.rb
|
metadata.gz.sig
CHANGED
Binary file
|