statsample 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +14 -0
- data/Gemfile +1 -16
- data/History.txt +51 -46
- data/LICENSE.txt +7 -82
- data/README.md +145 -150
- data/Rakefile +20 -102
- data/lib/spss.rb +17 -14
- data/lib/statsample/crosstab.rb +2 -2
- data/lib/statsample/dataset.rb +82 -81
- data/lib/statsample/matrix.rb +43 -43
- data/lib/statsample/reliability.rb +1 -2
- data/lib/statsample/vector.rb +157 -124
- data/lib/statsample/version.rb +1 -1
- data/lib/statsample.rb +91 -91
- data/references.txt +2 -1
- data/statsample.gemspec +89 -0
- data/test/test_awesome_print_bug.rb +16 -0
- data/test/test_crosstab.rb +8 -0
- data/test/test_histogram.rb +7 -0
- data/test/test_vector.rb +62 -48
- metadata +109 -120
- data/.gemtest +0 -0
- data/Gemfile.lock +0 -78
- data/Manifest.txt +0 -157
- data/setup.rb +0 -1585
data/README.md
CHANGED
@@ -1,102 +1,132 @@
|
|
1
1
|
# Statsample
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://travis-ci.org/SciRuby/statsample.svg?branch=master)](https://travis-ci.org/SciRuby/statsample)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/SciRuby/statsample/badges/gpa.svg)](https://codeclimate.com/github/SciRuby/statsample)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/statsample.svg)](http://badge.fury.io/rb/statsample)
|
4
6
|
|
5
|
-
|
7
|
+
Homepage :: https://github.com/sciruby/statsample
|
6
8
|
|
7
|
-
|
9
|
+
# Installation
|
10
|
+
|
11
|
+
You should have a recent version of GSL and R (with the `irr` and `Rserve` libraries) installed. In Ubuntu:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
$ sudo apt-get install libgs10-dev r-base r-base-dev
|
15
|
+
$ sudo Rscript -e "install.packages(c('Rserve', 'irr'))"
|
16
|
+
```
|
17
|
+
|
18
|
+
With these libraries in place, just install from rubygems:
|
8
19
|
|
9
|
-
|
20
|
+
```bash
|
21
|
+
$ [sudo] gem install statsample
|
22
|
+
```
|
23
|
+
|
24
|
+
On *nix, you should install statsample-optimization to retrieve gems gsl, statistics2 and a C extension to speed some methods.
|
25
|
+
|
26
|
+
```bash
|
27
|
+
$ [sudo] gem install statsample-optimization
|
28
|
+
```
|
29
|
+
|
30
|
+
If you need to work on Structural Equation Modeling, you could see +statsample-sem+. You need R with +sem+ or +OpenMx+ [http://openmx.psyc.virginia.edu/] libraries installed
|
31
|
+
|
32
|
+
```bash
|
33
|
+
$ [sudo] gem install statsample-sem
|
34
|
+
```
|
35
|
+
|
36
|
+
# Description
|
37
|
+
|
38
|
+
A suite for basic and advanced statistics on Ruby. Tested on CRuby 1.9.3, 2.0.0 and 2.1.1. See `.travis.yml` for more information.
|
10
39
|
|
11
40
|
Include:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
41
|
+
- Descriptive statistics: frequencies, median, mean, standard error, skew, kurtosis (and many others).
|
42
|
+
- Imports and exports datasets from and to Excel, CSV and plain text files.
|
43
|
+
- 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.
|
44
|
+
- Intra-class correlation
|
45
|
+
- Anova: generic and vector-based One-way ANOVA and Two-way ANOVA, with contrasts for One-way ANOVA.
|
46
|
+
- Tests: F, T, Levene, U-Mannwhitney.
|
47
|
+
- Regression: Simple, Multiple (OLS), Probit and Logit
|
48
|
+
- 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.
|
49
|
+
- Reliability analysis for simple scale and a DSL to easily analyze multiple scales using factor analysis and correlations, if you want it.
|
50
|
+
- Basic time series support
|
51
|
+
- Dominance Analysis, with multivariate dependent and bootstrap (Azen & Budescu)
|
52
|
+
- Sample calculation related formulas
|
53
|
+
- Structural Equation Modeling (SEM), using R libraries +sem+ and +OpenMx+
|
54
|
+
- Creates reports on text, html and rtf, using ReportBuilder gem
|
55
|
+
- Graphics: Histogram, Boxplot and Scatterplot
|
27
56
|
|
28
57
|
## Principles
|
29
58
|
|
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
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
59
|
+
- Software Design:
|
60
|
+
- One module/class for each type of analysis
|
61
|
+
- Options can be set as hash on initialize() or as setters methods
|
62
|
+
- Clean API for interactive sessions
|
63
|
+
- summary() returns all necessary informacion for interactive sessions
|
64
|
+
- All statistical data available though methods on objects
|
65
|
+
- All (important) methods should be tested. Better with random data.
|
66
|
+
- Statistical Design
|
67
|
+
- Results are tested against text results, SPSS and R outputs.
|
68
|
+
- Go beyond Null Hiphotesis Testing, using confidence intervals and effect sizes when possible
|
69
|
+
- (When possible) All references for methods are documented, providing sensible information on documentation
|
70
|
+
|
71
|
+
# Features
|
72
|
+
|
73
|
+
- Classes for manipulation and storage of data:
|
74
|
+
- Statsample::Vector: An extension of an array, with statistical methods like sum, mean and standard deviation
|
75
|
+
- Statsample::Dataset: a group of Statsample::Vector, analog to a excel spreadsheet or a dataframe on R. The base of almost all operations on statsample.
|
76
|
+
- Statsample::Multiset: multiple datasets with same fields and type of vectors
|
77
|
+
- Anova module provides generic Statsample::Anova::OneWay and vector based Statsample::Anova::OneWayWithVectors. Also you can create contrast using Statsample::Anova::Contrast
|
78
|
+
- Module Statsample::Bivariate provides covariance and pearson, spearman, point biserial, tau a, tau b, gamma, tetrachoric (see Bivariate::Tetrachoric) and polychoric (see Bivariate::Polychoric) correlations. Include methods to create correlation and covariance matrices
|
79
|
+
- Multiple types of regression.
|
80
|
+
- Simple Regression : Statsample::Regression::Simple
|
81
|
+
- Multiple Regression: Statsample::Regression::Multiple
|
82
|
+
- Logit Regression: Statsample::Regression::Binomial::Logit
|
83
|
+
- Probit Regression: Statsample::Regression::Binomial::Probit
|
84
|
+
- Factorial Analysis algorithms on Statsample::Factor module.
|
85
|
+
- Classes for Extraction of factors:
|
86
|
+
- Statsample::Factor::PCA
|
87
|
+
- Statsample::Factor::PrincipalAxis
|
88
|
+
- Classes for Rotation of factors:
|
89
|
+
- Statsample::Factor::Varimax
|
90
|
+
- Statsample::Factor::Equimax
|
91
|
+
- Statsample::Factor::Quartimax
|
92
|
+
- Classes for calculation of factors to retain
|
93
|
+
- Statsample::Factor::ParallelAnalysis performs Horn's 'parallel analysis' to a principal components analysis to adjust for sample bias in the retention of components.
|
94
|
+
- Statsample::Factor::MAP performs Velicer's Minimum Average Partial (MAP) test, which retain components as long as the variance in the correlation matrix represents systematic variance.
|
95
|
+
- 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
|
96
|
+
- Statsample::DominanceAnalysis class can report dominance analysis for a sample, using uni or multivariate dependent variables
|
97
|
+
- 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/].
|
98
|
+
- Module Statsample::Codification, to help to codify open questions
|
99
|
+
- Converters to import and export data:
|
100
|
+
- Statsample::Database : Can create sql to create tables, read and insert data
|
101
|
+
- Statsample::CSV : Read and write CSV files
|
102
|
+
- Statsample::Excel : Read and write Excel files
|
103
|
+
- Statsample::Mx : Write Mx Files
|
104
|
+
- Statsample::GGobi : Write Ggobi files
|
105
|
+
- Module Statsample::Crosstab provides function to create crosstab for categorical data
|
106
|
+
- Module Statsample::Reliability provides functions to analyze scales with psychometric methods.
|
107
|
+
- Class Statsample::Reliability::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.
|
108
|
+
- Class Statsample::Reliability::MultiScaleAnalysis provides a DSL to easily analyze reliability of multiple scales and retrieve correlation matrix and factor analysis of them.
|
109
|
+
- Class Statsample::Reliability::ICC provides intra-class correlation, using Shrout & Fleiss(1979) and McGraw & Wong (1996) formulations.
|
110
|
+
- Module Statsample::SRS (Simple Random Sampling) provides a lot of functions to estimate standard error for several type of samples
|
111
|
+
- Module Statsample::Test provides several methods and classes to perform inferencial statistics
|
112
|
+
- Statsample::Test::BartlettSphericity
|
113
|
+
- Statsample::Test::ChiSquare
|
114
|
+
- Statsample::Test::F
|
115
|
+
- Statsample::Test::KolmogorovSmirnov (only D value)
|
116
|
+
- Statsample::Test::Levene
|
117
|
+
- Statsample::Test::UMannWhitney
|
118
|
+
- Statsample::Test::T
|
119
|
+
- Statsample::Test::WilcoxonSignedRank
|
120
|
+
- Module Graph provides several classes to create beautiful graphs using rubyvis
|
121
|
+
- Statsample::Graph::Boxplot
|
122
|
+
- Statsample::Graph::Histogram
|
123
|
+
- Statsample::Graph::Scatterplot
|
124
|
+
- Gem <tt>bio-statsample-timeseries</tt> provides module Statsample::TimeSeries with support for time series, including ARIMA estimation using Kalman-Filter.
|
125
|
+
- Gem <tt>statsample-sem</tt> provides a DSL to R libraries +sem+ and +OpenMx+
|
126
|
+
- Gem <tt>statsample-glm</tt> provides you with GML method, to work with Logistic, Poisson and Gaussian regression ,using ML or IRWLS.
|
127
|
+
- Close integration with gem <tt>reportbuilder</tt>, to easily create reports on text, html and rtf formats.
|
128
|
+
|
129
|
+
# Usage
|
100
130
|
|
101
131
|
See the [examples folder](https://github.com/clbustos/statsample/tree/master/examples/) too.
|
102
132
|
|
@@ -105,18 +135,23 @@ See the [examples folder](https://github.com/clbustos/statsample/tree/master/exa
|
|
105
135
|
```ruby
|
106
136
|
require 'statsample'
|
107
137
|
|
108
|
-
ss_analysis(Statsample::Graph::Boxplot) do
|
109
|
-
n=30
|
110
|
-
a=rnorm(n-1,50,10)
|
111
|
-
b=rnorm(n, 30,5)
|
112
|
-
c=rnorm(n,5,1)
|
138
|
+
ss_analysis(Statsample::Graph::Boxplot) do
|
139
|
+
n = 30
|
140
|
+
a = rnorm(n-1, 50, 10)
|
141
|
+
b = rnorm(n, 30, 5)
|
142
|
+
c = rnorm(n, 5, 1)
|
113
143
|
a.push(2)
|
114
|
-
boxplot(:
|
144
|
+
boxplot(vectors: [a, b, c],
|
145
|
+
width: 300,
|
146
|
+
height: 300,
|
147
|
+
groups: %w{first first second},
|
148
|
+
minimum: 0)
|
115
149
|
end
|
150
|
+
|
116
151
|
Statsample::Analysis.run # Open svg file on *nix application defined
|
117
152
|
```
|
118
153
|
|
119
|
-
|
154
|
+
## Correlation matrix
|
120
155
|
|
121
156
|
```ruby
|
122
157
|
require 'statsample'
|
@@ -124,67 +159,27 @@ require 'statsample'
|
|
124
159
|
# and correlation matrix
|
125
160
|
|
126
161
|
ss_analysis("Statsample::Bivariate.correlation_matrix") do
|
127
|
-
samples=1000
|
128
|
-
ds=data_frame(
|
129
|
-
'a'=>rnorm(samples),
|
130
|
-
'b'=>rnorm(samples),
|
131
|
-
'c'=>rnorm(samples),
|
132
|
-
'd'=>rnorm(samples))
|
133
|
-
cm=cor(ds)
|
162
|
+
samples = 1000
|
163
|
+
ds = data_frame(
|
164
|
+
'a' => rnorm(samples),
|
165
|
+
'b' => rnorm(samples),
|
166
|
+
'c' => rnorm(samples),
|
167
|
+
'd' => rnorm(samples))
|
168
|
+
cm = cor(ds)
|
134
169
|
summary(cm)
|
135
170
|
end
|
136
171
|
|
137
172
|
Statsample::Analysis.run_batch # Echo output to console
|
138
173
|
```
|
139
174
|
|
140
|
-
|
141
|
-
|
142
|
-
Optional:
|
143
|
-
|
144
|
-
* Plotting: gnuplot and rbgnuplot, SVG::Graph
|
145
|
-
* Factorial analysis and polychorical correlation(joint estimate and polychoric series): gsl library and rb-gsl (https://rubygems.org/gems/rb-gsl/). You should install it using <tt>gem install rb-gsl</tt>.
|
146
|
-
|
147
|
-
*Note*: Use gsl 1.12.109 or later.
|
148
|
-
|
149
|
-
## Resources
|
150
|
-
|
151
|
-
* Source code on github :: http://github.com/clbustos/statsample
|
152
|
-
* Docs :: http://rubydoc.info/gems/statsample/
|
153
|
-
* Bug report and feature request :: http://github.com/clbustos/statsample/issues
|
154
|
-
* E-mailing list :: http://groups.google.com/group/statsample
|
155
|
-
|
156
|
-
# Installation
|
157
|
-
|
158
|
-
```bash
|
159
|
-
$ sudo gem install statsample
|
160
|
-
```
|
161
|
-
|
162
|
-
On *nix, you should install statsample-optimization to retrieve gems gsl, statistics2 and a C extension to speed some methods.
|
163
|
-
|
164
|
-
There are available precompiled version for Ruby 1.9 on x86, x86_64 and mingw32 archs.
|
165
|
-
|
166
|
-
```bash
|
167
|
-
$ sudo gem install statsample-optimization
|
168
|
-
```
|
175
|
+
# Resources
|
169
176
|
|
170
|
-
|
177
|
+
- Source code on github :: http://github.com/sciruby/statsample
|
178
|
+
- Bug report and feature request :: http://github.com/sciruby/statsample/issues
|
179
|
+
- E-mailing list :: https://groups.google.com/forum/#!forum/sciruby-dev
|
171
180
|
|
172
|
-
|
173
|
-
$ sudo gem install statsample-optimization --platform ruby
|
174
|
-
```
|
175
|
-
|
176
|
-
If you need to work on Structural Equation Modeling, you could see +statsample-sem+. You need R with +sem+ or +OpenMx+ [http://openmx.psyc.virginia.edu/] libraries installed
|
177
|
-
|
178
|
-
```bash
|
179
|
-
$ sudo gem install statsample-sem
|
180
|
-
```
|
181
|
-
|
182
|
-
Available setup.rb file
|
183
|
-
|
184
|
-
```bash
|
185
|
-
sudo gem ruby setup.rb
|
186
|
-
```
|
181
|
+
# License
|
187
182
|
|
188
|
-
|
183
|
+
BSD-3 (See LICENSE.txt)
|
189
184
|
|
190
|
-
|
185
|
+
Could change between version, without previous warning. If you want a specific license, just choose the version that you need.
|
data/Rakefile
CHANGED
@@ -1,32 +1,30 @@
|
|
1
|
-
|
2
|
-
# -*- ruby -*-
|
3
|
-
# -*- coding: utf-8 -*-
|
4
|
-
$:.unshift(File.dirname(__FILE__)+'/lib/')
|
1
|
+
$:.unshift File.expand_path("../lib/", __FILE__)
|
5
2
|
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
9
|
-
require 'rdoc'
|
3
|
+
require 'statsample/version'
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/testtask'
|
6
|
+
require 'rdoc/task'
|
7
|
+
require 'bundler/gem_tasks'
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
}
|
9
|
+
# Setup the necessary gems, specified in the gemspec.
|
10
|
+
require 'bundler'
|
11
|
+
begin
|
12
|
+
Bundler.setup(:default, :development)
|
13
|
+
rescue Bundler::BundlerError => e
|
14
|
+
$stderr.puts e.message
|
15
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
16
|
+
exit e.status_code
|
21
17
|
end
|
22
18
|
|
23
|
-
|
24
|
-
|
19
|
+
Rake::TestTask.new do |t|
|
20
|
+
t.pattern = "test/test_*.rb"
|
25
21
|
end
|
26
22
|
|
27
|
-
|
28
|
-
|
23
|
+
RDoc::Task.new do |rdoc|
|
24
|
+
rdoc.main = "README.md"
|
25
|
+
rdoc.rdoc_files.include("README.md", "lib", "History.txt", "LICENSE.txt", "references.txt")
|
29
26
|
end
|
27
|
+
|
30
28
|
desc "Update pot/po files."
|
31
29
|
task "gettext:updatepo" do
|
32
30
|
require 'gettext/tools'
|
@@ -37,84 +35,4 @@ desc "Create mo-files"
|
|
37
35
|
task "gettext:makemo" do
|
38
36
|
require 'gettext/tools'
|
39
37
|
GetText.create_mofiles()
|
40
|
-
# GetText.create_mofiles(true, "po", "locale") # This is for "Ruby on Rails".
|
41
|
-
end
|
42
|
-
|
43
|
-
h=Hoe.spec('statsample') do
|
44
|
-
self.version=Statsample::VERSION
|
45
|
-
self.urls=["https://github.com/clbustos/statsample"]
|
46
|
-
#self.testlib=:minitest
|
47
|
-
self.readme_file = 'README.md'
|
48
|
-
self.urls = ['https://github.com/clbustos/statsample']
|
49
|
-
self.developer('Claudio Bustos', 'clbustos@gmail.com')
|
50
|
-
self.extra_deps << ["spreadsheet","~>0.6"] << ["reportbuilder", "~>1.4"] << ["minimization", "~>0.2.0"] << ["fastercsv", ">0"] << ["dirty-memoize", "~>0.0"] << ["extendmatrix","~>0.3.1"] << ["statsample-bivariate-extension", ">0"] << ["rserve-client"] << ["rubyvis"] << ["distribution"]
|
51
|
-
|
52
|
-
self.extra_dev_deps << ["hoe","~>0"] << ["shoulda","~>3"] << ["minitest", "~>2"] << ["gettext", "~>0"] << ["mocha", "~>0"] << ["hoe-git", "~>0"]
|
53
|
-
|
54
|
-
self.clean_globs << "test/images/*" << "demo/item_analysis/*" << "demo/Regression"
|
55
|
-
self.post_install_message = <<-EOF
|
56
|
-
***************************************************
|
57
|
-
Thanks for installing statsample.
|
58
|
-
|
59
|
-
On *nix, you could install statsample-optimization
|
60
|
-
to retrieve gems gsl, statistics2 and a C extension
|
61
|
-
to speed some methods.
|
62
|
-
|
63
|
-
$ sudo gem install statsample-optimization
|
64
|
-
|
65
|
-
On Ubuntu, install build-essential and libgsl0-dev
|
66
|
-
using apt-get. Compile ruby 1.8 or 1.9 from
|
67
|
-
source code first.
|
68
|
-
|
69
|
-
$ sudo apt-get install build-essential libgsl0-dev
|
70
|
-
|
71
|
-
|
72
|
-
*****************************************************
|
73
|
-
EOF
|
74
|
-
self.need_rdoc=false
|
75
|
-
end
|
76
|
-
|
77
|
-
if Rake.const_defined?(:RDocTask)
|
78
|
-
Rake::RDocTask.new(:docs) do |rd|
|
79
|
-
rd.main = h.readme_file
|
80
|
-
rd.options << '-d' if (`which dot` =~ /\/dot/) unless
|
81
|
-
ENV['NODOT'] || Hoe::WINDOZE
|
82
|
-
rd.rdoc_dir = 'doc'
|
83
|
-
|
84
|
-
rd.rdoc_files.include("lib/**/*.rb")
|
85
|
-
rd.rdoc_files += h.spec.extra_rdoc_files
|
86
|
-
rd.rdoc_files.reject! {|f| f=="Manifest.txt"}
|
87
|
-
title = h.spec.rdoc_options.grep(/^(-t|--title)=?$/).first
|
88
|
-
if title then
|
89
|
-
rd.options << title
|
90
|
-
|
91
|
-
unless title =~ /\=/ then # for ['-t', 'title here']
|
92
|
-
title_index = spec.rdoc_options.index(title)
|
93
|
-
rd.options << spec.rdoc_options[title_index + 1]
|
94
|
-
end
|
95
|
-
else
|
96
|
-
title = "#{h.name}-#{h.version} Documentation"
|
97
|
-
title = "#{h.rubyforge_name}'s " + title if h.rubyforge_name != h.name
|
98
|
-
rd.options << '--title' << title
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
desc 'Publish rdocs with analytics support'
|
105
|
-
task :publicar_docs => [:clean, :docs] do
|
106
|
-
ruby %{agregar_adsense_a_doc.rb}
|
107
|
-
path = File.expand_path("~/.rubyforge/user-config.yml")
|
108
|
-
config = YAML.load(File.read(path))
|
109
|
-
host = "#{config["username"]}@rubyforge.org"
|
110
|
-
|
111
|
-
remote_dir = "/var/www/gforge-projects/#{h.rubyforge_name}/#{h.remote_rdoc_dir
|
112
|
-
}"
|
113
|
-
local_dir = h.local_rdoc_dir
|
114
|
-
Dir.glob(local_dir+"/**/*") {|file|
|
115
|
-
sh %{chmod 755 #{file}}
|
116
|
-
}
|
117
|
-
sh %{rsync #{h.rsync_args} #{local_dir}/ #{host}:#{remote_dir}}
|
118
38
|
end
|
119
|
-
|
120
|
-
# vim: syntax=Ruby
|
data/lib/spss.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# = spss.rb -
|
1
|
+
# = spss.rb -
|
2
2
|
#
|
3
3
|
# Provides utilites for working with spss files
|
4
4
|
#
|
@@ -12,40 +12,43 @@ module SPSS # :nodoc: all
|
|
12
12
|
def add(a)
|
13
13
|
@elements.push(a)
|
14
14
|
end
|
15
|
-
|
16
|
-
|
15
|
+
|
16
|
+
def parse_elements(func = :to_s)
|
17
|
+
@elements.collect{ |e| " "+e.send(func) }.join("\n")
|
17
18
|
end
|
19
|
+
|
18
20
|
def init_with config
|
19
|
-
config.each
|
20
|
-
self.send(key.to_s+"=",value) if methods.include? key.to_s
|
21
|
-
|
21
|
+
config.each do |key, value|
|
22
|
+
self.send(key.to_s + "=", value) if methods.include? key.to_s
|
23
|
+
end
|
22
24
|
end
|
23
|
-
|
24
|
-
|
25
|
-
@
|
25
|
+
|
26
|
+
def initialize(config = {})
|
27
|
+
@config = config
|
28
|
+
@elements = []
|
26
29
|
end
|
27
30
|
end
|
28
31
|
class Dictionary < Element
|
29
32
|
attr_accessor :locale, :date_time, :row_count
|
30
|
-
def initialize(config={})
|
33
|
+
def initialize(config = {})
|
31
34
|
super
|
32
35
|
init_with ({
|
33
|
-
:locale=>"en_US",
|
36
|
+
:locale=>"en_US",
|
34
37
|
:date_time=>Time.new().strftime("%Y-%m-%dT%H:%M:%S"),
|
35
38
|
:row_count=>1
|
36
39
|
})
|
37
40
|
init_with config
|
38
41
|
end
|
39
|
-
|
42
|
+
|
40
43
|
def to_xml
|
41
44
|
"<dictionary locale='#{@locale}' creationDateTime='#{@date_time}' rowCount='#{@row_count}' xmlns='http://xml.spss.com/spss/data'>\n"+parse_elements(:to_xml)+"\n</dictionary>"
|
42
|
-
|
45
|
+
|
43
46
|
end
|
44
47
|
def to_spss
|
45
48
|
parse_elements(:to_spss)
|
46
49
|
end
|
47
50
|
end
|
48
|
-
|
51
|
+
|
49
52
|
class MissingValue < Element
|
50
53
|
attr_accessor :data, :type, :from, :to
|
51
54
|
def initialize(data,type=nil)
|
data/lib/statsample/crosstab.rb
CHANGED
@@ -8,9 +8,9 @@ module Statsample
|
|
8
8
|
attr_reader :v_rows, :v_cols
|
9
9
|
attr_accessor :row_label, :column_label, :name, :percentage_row, :percentage_column, :percentage_total
|
10
10
|
def initialize(v1, v2, opts=Hash.new)
|
11
|
-
raise ArgumentError, "Both arguments should be Vectors" unless v1.is_a? Statsample::Vector and v2.is_a? Statsample::Vector
|
11
|
+
#raise ArgumentError, "Both arguments should be Vectors" unless v1.is_a? Statsample::Vector and v2.is_a? Statsample::Vector
|
12
12
|
raise ArgumentError, "Vectors should be the same size" unless v1.size==v2.size
|
13
|
-
@v_rows, @v_cols=Statsample.only_valid_clone(v1,v2)
|
13
|
+
@v_rows, @v_cols=Statsample.only_valid_clone(v1.to_vector,v2.to_vector)
|
14
14
|
@cases=@v_rows.size
|
15
15
|
@row_label=v1.name
|
16
16
|
@column_label=v2.name
|