least_squares 0.1.1 → 1.0.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/CHANGELOG.md +18 -0
- metadata +23 -34
- data/.gitignore +0 -23
- data/.yardopts +0 -3
- data/CHANGELOG +0 -7
- data/Rakefile +0 -47
- data/VERSION +0 -1
- data/least_squares.gemspec +0 -60
- data/spec/least_squares_spec.rb +0 -42
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -9
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Least Squares 1.0.0
|
|
2
|
+
===================
|
|
3
|
+
- Removed Jeweler dependency
|
|
4
|
+
- Updated to RSpec 2.0.0
|
|
5
|
+
|
|
6
|
+
Least Squares 0.1.1
|
|
7
|
+
===================
|
|
8
|
+
|
|
9
|
+
Features
|
|
10
|
+
--------
|
|
11
|
+
- Use #zip in place of #each in #pearson
|
|
12
|
+
|
|
13
|
+
Least Squares 0.1.0
|
|
14
|
+
===================
|
|
15
|
+
|
|
16
|
+
Features
|
|
17
|
+
--------
|
|
18
|
+
- initial release
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: least_squares
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 23
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
|
-
- 0
|
|
8
|
-
- 1
|
|
9
7
|
- 1
|
|
10
|
-
|
|
8
|
+
- 0
|
|
9
|
+
- 0
|
|
10
|
+
version: 1.0.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Shane Emmons
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2010-05
|
|
18
|
+
date: 2010-11-05 00:00:00 -04:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -26,12 +26,12 @@ dependencies:
|
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
hash:
|
|
29
|
+
hash: 15
|
|
30
30
|
segments:
|
|
31
|
-
-
|
|
32
|
-
- 3
|
|
31
|
+
- 2
|
|
33
32
|
- 0
|
|
34
|
-
|
|
33
|
+
- 0
|
|
34
|
+
version: 2.0.0
|
|
35
35
|
type: :development
|
|
36
36
|
version_requirements: *id001
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
@@ -45,9 +45,7 @@ dependencies:
|
|
|
45
45
|
hash: 3
|
|
46
46
|
segments:
|
|
47
47
|
- 0
|
|
48
|
-
|
|
49
|
-
- 4
|
|
50
|
-
version: 0.5.4
|
|
48
|
+
version: "0"
|
|
51
49
|
type: :development
|
|
52
50
|
version_requirements: *id002
|
|
53
51
|
description: This gem adds methods to the Math module to aid in calculating the Least Squares Regression Line given two arrays.
|
|
@@ -56,30 +54,20 @@ executables: []
|
|
|
56
54
|
|
|
57
55
|
extensions: []
|
|
58
56
|
|
|
59
|
-
extra_rdoc_files:
|
|
60
|
-
|
|
61
|
-
- LICENSE
|
|
62
|
-
- README.md
|
|
57
|
+
extra_rdoc_files: []
|
|
58
|
+
|
|
63
59
|
files:
|
|
64
|
-
- .
|
|
65
|
-
- .
|
|
66
|
-
- CHANGELOG
|
|
60
|
+
- lib/least_squares.rb
|
|
61
|
+
- CHANGELOG.md
|
|
67
62
|
- LICENSE
|
|
68
63
|
- README.md
|
|
69
|
-
- Rakefile
|
|
70
|
-
- VERSION
|
|
71
|
-
- least_squares.gemspec
|
|
72
|
-
- lib/least_squares.rb
|
|
73
|
-
- spec/least_squares_spec.rb
|
|
74
|
-
- spec/spec.opts
|
|
75
|
-
- spec/spec_helper.rb
|
|
76
64
|
has_rdoc: true
|
|
77
65
|
homepage: http://github.com/semmons99/least_squares
|
|
78
66
|
licenses: []
|
|
79
67
|
|
|
80
68
|
post_install_message:
|
|
81
|
-
rdoc_options:
|
|
82
|
-
|
|
69
|
+
rdoc_options: []
|
|
70
|
+
|
|
83
71
|
require_paths:
|
|
84
72
|
- lib
|
|
85
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -96,10 +84,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
96
84
|
requirements:
|
|
97
85
|
- - ">="
|
|
98
86
|
- !ruby/object:Gem::Version
|
|
99
|
-
hash:
|
|
87
|
+
hash: 23
|
|
100
88
|
segments:
|
|
101
|
-
-
|
|
102
|
-
|
|
89
|
+
- 1
|
|
90
|
+
- 3
|
|
91
|
+
- 6
|
|
92
|
+
version: 1.3.6
|
|
103
93
|
requirements: []
|
|
104
94
|
|
|
105
95
|
rubyforge_project:
|
|
@@ -107,6 +97,5 @@ rubygems_version: 1.3.7
|
|
|
107
97
|
signing_key:
|
|
108
98
|
specification_version: 3
|
|
109
99
|
summary: Calulate the Least Squares Regression Line
|
|
110
|
-
test_files:
|
|
111
|
-
|
|
112
|
-
- spec/spec_helper.rb
|
|
100
|
+
test_files: []
|
|
101
|
+
|
data/.gitignore
DELETED
data/.yardopts
DELETED
data/CHANGELOG
DELETED
data/Rakefile
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'rake'
|
|
3
|
-
require 'rake/clean'
|
|
4
|
-
|
|
5
|
-
CLOBBER.include('.yardoc', 'doc', 'pkg')
|
|
6
|
-
|
|
7
|
-
begin
|
|
8
|
-
require 'jeweler'
|
|
9
|
-
Jeweler::Tasks.new do |gem|
|
|
10
|
-
gem.name = "least_squares"
|
|
11
|
-
gem.summary = %Q{Calulate the Least Squares Regression Line}
|
|
12
|
-
gem.description = %Q{This gem adds methods to the Math module to aid in calculating the Least Squares Regression Line given two arrays.}
|
|
13
|
-
gem.email = "semmons99@gmail.com"
|
|
14
|
-
gem.homepage = "http://github.com/semmons99/least_squares"
|
|
15
|
-
gem.authors = ["Shane Emmons"]
|
|
16
|
-
gem.add_development_dependency "rspec", ">= 1.3.0"
|
|
17
|
-
gem.add_development_dependency "yard", ">= 0.5.4"
|
|
18
|
-
end
|
|
19
|
-
Jeweler::GemcutterTasks.new
|
|
20
|
-
rescue LoadError
|
|
21
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
require 'spec/rake/spectask'
|
|
25
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
|
26
|
-
spec.libs << 'lib' << 'spec'
|
|
27
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
31
|
-
spec.libs << 'lib' << 'spec'
|
|
32
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
|
33
|
-
spec.rcov = true
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
task :spec => :check_dependencies
|
|
37
|
-
|
|
38
|
-
task :default => :spec
|
|
39
|
-
|
|
40
|
-
begin
|
|
41
|
-
require 'yard'
|
|
42
|
-
YARD::Rake::YardocTask.new
|
|
43
|
-
rescue LoadError
|
|
44
|
-
task :yardoc do
|
|
45
|
-
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
|
46
|
-
end
|
|
47
|
-
end
|
data/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.1.1
|
data/least_squares.gemspec
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Generated by jeweler
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
|
|
4
|
-
# -*- encoding: utf-8 -*-
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |s|
|
|
7
|
-
s.name = %q{least_squares}
|
|
8
|
-
s.version = "0.1.1"
|
|
9
|
-
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
-
s.authors = ["Shane Emmons"]
|
|
12
|
-
s.date = %q{2010-05-17}
|
|
13
|
-
s.description = %q{This gem adds methods to the Math module to aid in calculating the Least Squares Regression Line given two arrays.}
|
|
14
|
-
s.email = %q{semmons99@gmail.com}
|
|
15
|
-
s.extra_rdoc_files = [
|
|
16
|
-
"CHANGELOG",
|
|
17
|
-
"LICENSE",
|
|
18
|
-
"README.md"
|
|
19
|
-
]
|
|
20
|
-
s.files = [
|
|
21
|
-
".gitignore",
|
|
22
|
-
".yardopts",
|
|
23
|
-
"CHANGELOG",
|
|
24
|
-
"LICENSE",
|
|
25
|
-
"README.md",
|
|
26
|
-
"Rakefile",
|
|
27
|
-
"VERSION",
|
|
28
|
-
"least_squares.gemspec",
|
|
29
|
-
"lib/least_squares.rb",
|
|
30
|
-
"spec/least_squares_spec.rb",
|
|
31
|
-
"spec/spec.opts",
|
|
32
|
-
"spec/spec_helper.rb"
|
|
33
|
-
]
|
|
34
|
-
s.homepage = %q{http://github.com/semmons99/least_squares}
|
|
35
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
|
36
|
-
s.require_paths = ["lib"]
|
|
37
|
-
s.rubygems_version = %q{1.3.7}
|
|
38
|
-
s.summary = %q{Calulate the Least Squares Regression Line}
|
|
39
|
-
s.test_files = [
|
|
40
|
-
"spec/least_squares_spec.rb",
|
|
41
|
-
"spec/spec_helper.rb"
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
if s.respond_to? :specification_version then
|
|
45
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
46
|
-
s.specification_version = 3
|
|
47
|
-
|
|
48
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
49
|
-
s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
|
|
50
|
-
s.add_development_dependency(%q<yard>, [">= 0.5.4"])
|
|
51
|
-
else
|
|
52
|
-
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
|
53
|
-
s.add_dependency(%q<yard>, [">= 0.5.4"])
|
|
54
|
-
end
|
|
55
|
-
else
|
|
56
|
-
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
|
57
|
-
s.add_dependency(%q<yard>, [">= 0.5.4"])
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
data/spec/least_squares_spec.rb
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
|
|
3
|
-
describe "LeastSquares" do
|
|
4
|
-
before(:each) do
|
|
5
|
-
@xs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
6
|
-
@ys = [9, 1, 0, 5, 4, 7, 7, 0, 9, 3]
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe '#mean' do
|
|
10
|
-
specify 'returns the mean (average) of an array of numbers' do
|
|
11
|
-
Math.mean(@xs).should == 5.5
|
|
12
|
-
Math.mean(@ys).should == 4.5
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe '#stdev' do
|
|
17
|
-
specify 'returns the standard deviation of an array of numbers' do
|
|
18
|
-
Math.stdev(@xs).should be_close(3.0277, 0.0001)
|
|
19
|
-
Math.stdev(@ys).should be_close(3.4721, 0.0001)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe '#pearson' do
|
|
24
|
-
specify 'returns the Pearson Correlation Coefficient of two arrays of numbers' do
|
|
25
|
-
Math.pearson(@xs,@ys).should be_close(0.0581, 0.0001)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe '#least_squares' do
|
|
30
|
-
specify 'returns the Least Squares Regression Line of two arrays of numbers as a Proc' do
|
|
31
|
-
Math.least_squares(@xs,@ys).should be_a(Proc)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
specify 'return the Least Squares Regression Line of two arrays of numbers' do
|
|
35
|
-
rs = [4.2, 4.2667, 4.3333, 4.4, 4.4667, 4.5333, 4.6, 4.6667, 4.7333, 4.8]
|
|
36
|
-
ls = Math.least_squares(@xs,@ys)
|
|
37
|
-
(1..10).map{|i| ls.call(i)}.each_with_index do |x,i|
|
|
38
|
-
x.should be_close(rs[i], 0.0001)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
data/spec/spec.opts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--color
|