sciruby 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +23 -0
- data/.gemtest +0 -0
- data/History.txt +6 -0
- data/Manifest.txt +119 -0
- data/Rakefile +178 -0
- data/bin/sciruby-plotter +12 -0
- data/data/r/man/AirPassengers.Rd +51 -0
- data/data/r/man/BJsales.Rd +34 -0
- data/data/r/man/BOD.Rd +53 -0
- data/data/r/man/ChickWeight.Rd +68 -0
- data/data/r/man/DNase.Rd +63 -0
- data/data/r/man/EuStockMarkets.Rd +28 -0
- data/data/r/man/Formaldehyde.Rd +44 -0
- data/data/r/man/HairEyeColor.Rd +77 -0
- data/data/r/man/Harman23.cor.Rd +25 -0
- data/data/r/man/Harman74.cor.Rd +28 -0
- data/data/r/man/Indometh.Rd +57 -0
- data/data/r/man/InsectSprays.Rd +45 -0
- data/data/r/man/JohnsonJohnson.Rd +37 -0
- data/data/r/man/LakeHuron.Rd +27 -0
- data/data/r/man/LifeCycleSavings.Rd +54 -0
- data/data/r/man/Loblolly.Rd +56 -0
- data/data/r/man/Nile.Rd +78 -0
- data/data/r/man/Orange.Rd +57 -0
- data/data/r/man/OrchardSprays.Rd +62 -0
- data/data/r/man/PlantGrowth.Rd +39 -0
- data/data/r/man/Puromycin.Rd +84 -0
- data/data/r/man/Theoph.Rd +84 -0
- data/data/r/man/Titanic.Rd +73 -0
- data/data/r/man/ToothGrowth.Rd +40 -0
- data/data/r/man/UCBAdmissions.Rd +68 -0
- data/data/r/man/UKDriverDeaths.Rd +72 -0
- data/data/r/man/UKLungDeaths.Rd +40 -0
- data/data/r/man/UKgas.Rd +25 -0
- data/data/r/man/USAccDeaths.Rd +23 -0
- data/data/r/man/USArrests.Rd +45 -0
- data/data/r/man/USJudgeRatings.Rd +38 -0
- data/data/r/man/USPersonalExpenditure.Rd +33 -0
- data/data/r/man/VADeaths.Rd +51 -0
- data/data/r/man/WWWusage.Rd +41 -0
- data/data/r/man/WorldPhones.Rd +40 -0
- data/data/r/man/ability.cov.Rd +50 -0
- data/data/r/man/airmiles.Rd +29 -0
- data/data/r/man/airquality.Rd +56 -0
- data/data/r/man/anscombe.Rd +62 -0
- data/data/r/man/attenu.Rd +66 -0
- data/data/r/man/attitude.Rd +48 -0
- data/data/r/man/austres.Rd +22 -0
- data/data/r/man/beavers.Rd +73 -0
- data/data/r/man/cars.Rd +59 -0
- data/data/r/man/chickwts.Rd +47 -0
- data/data/r/man/co2.Rd +43 -0
- data/data/r/man/crimtab.Rd +129 -0
- data/data/r/man/datasets-package.Rd +24 -0
- data/data/r/man/discoveries.Rd +30 -0
- data/data/r/man/esoph.Rd +66 -0
- data/data/r/man/euro.Rd +56 -0
- data/data/r/man/eurodist.Rd +25 -0
- data/data/r/man/faithful.Rd +63 -0
- data/data/r/man/freeny.Rd +56 -0
- data/data/r/man/infert.Rd +56 -0
- data/data/r/man/iris.Rd +62 -0
- data/data/r/man/islands.Rd +29 -0
- data/data/r/man/lh.Rd +22 -0
- data/data/r/man/longley.Rd +56 -0
- data/data/r/man/lynx.Rd +33 -0
- data/data/r/man/morley.Rd +50 -0
- data/data/r/man/mtcars.Rd +44 -0
- data/data/r/man/nhtemp.Rd +30 -0
- data/data/r/man/nottem.Rd +30 -0
- data/data/r/man/occupationalStatus.Rd +44 -0
- data/data/r/man/precip.Rd +31 -0
- data/data/r/man/presidents.Rd +36 -0
- data/data/r/man/pressure.Rd +41 -0
- data/data/r/man/quakes.Rd +40 -0
- data/data/r/man/randu.Rd +46 -0
- data/data/r/man/rivers.Rd +21 -0
- data/data/r/man/rock.Rd +34 -0
- data/data/r/man/sleep.Rd +51 -0
- data/data/r/man/stackloss.Rd +77 -0
- data/data/r/man/state.Rd +80 -0
- data/data/r/man/sunspot.month.Rd +49 -0
- data/data/r/man/sunspot.year.Rd +26 -0
- data/data/r/man/sunspots.Rd +33 -0
- data/data/r/man/swiss.Rd +79 -0
- data/data/r/man/treering.Rd +38 -0
- data/data/r/man/trees.Rd +48 -0
- data/data/r/man/uspop.Rd +27 -0
- data/data/r/man/volcano.Rd +31 -0
- data/data/r/man/warpbreaks.Rd +56 -0
- data/data/r/man/women.Rd +40 -0
- data/data/r/man/zCO2.Rd +81 -0
- data/lib/ext/csv.rb +22 -0
- data/lib/ext/shoes.rb +131 -0
- data/lib/ext/string.rb +39 -0
- data/lib/sciruby.rb +50 -4
- data/lib/sciruby/analysis.rb +98 -0
- data/lib/sciruby/analysis/suite.rb +87 -0
- data/lib/sciruby/analysis/suite_report_builder.rb +44 -0
- data/lib/sciruby/config.rb +93 -0
- data/lib/sciruby/data.rb +168 -0
- data/lib/sciruby/data/guardian.rb +96 -0
- data/lib/sciruby/data/r.rb +155 -0
- data/lib/sciruby/data/r/base.rb +110 -0
- data/lib/sciruby/data/r/data_frame.rb +24 -0
- data/lib/sciruby/data/r/grouped_data.rb +7 -0
- data/lib/sciruby/data/r/list.rb +20 -0
- data/lib/sciruby/data/r/multi_time_series.rb +24 -0
- data/lib/sciruby/data/r/r_matrix.rb +7 -0
- data/lib/sciruby/data/r/time_series.rb +19 -0
- data/lib/sciruby/data/r/time_series_base.rb +40 -0
- data/lib/sciruby/data/r/vector.rb +125 -0
- data/lib/sciruby/editor.rb +82 -0
- data/lib/sciruby/plotter.rb +128 -0
- data/lib/sciruby/recommend.rb +4 -0
- data/lib/sciruby/validation.rb +368 -0
- data/readme.md +75 -0
- data/static/sciruby-icon.png +0 -0
- data/test/helpers_tests.rb +58 -0
- data/test/test_recommend.rb +16 -0
- metadata +396 -20
data/.autotest
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'autotest/restart'
|
4
|
+
|
5
|
+
# Autotest.add_hook :initialize do |at|
|
6
|
+
# at.extra_files << "../some/external/dependency.rb"
|
7
|
+
#
|
8
|
+
# at.libs << ":../some/external"
|
9
|
+
#
|
10
|
+
# at.add_exception 'vendor'
|
11
|
+
#
|
12
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
13
|
+
# at.files_matching(/test_.*rb$/)
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# %w(TestA TestB).each do |klass|
|
17
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
|
21
|
+
# Autotest.add_hook :run_command do |at|
|
22
|
+
# system "rake build"
|
23
|
+
# end
|
data/.gemtest
ADDED
File without changes
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
.autotest
|
2
|
+
History.txt
|
3
|
+
Manifest.txt
|
4
|
+
readme.md
|
5
|
+
Rakefile
|
6
|
+
lib/sciruby.rb
|
7
|
+
lib/sciruby/validation.rb
|
8
|
+
lib/sciruby/recommend.rb
|
9
|
+
lib/sciruby/plotter.rb
|
10
|
+
lib/sciruby/editor.rb
|
11
|
+
lib/sciruby/config.rb
|
12
|
+
lib/sciruby/analysis.rb
|
13
|
+
lib/sciruby/analysis/suite.rb
|
14
|
+
lib/sciruby/analysis/suite_report_builder.rb
|
15
|
+
lib/sciruby/data.rb
|
16
|
+
lib/sciruby/data/guardian.rb
|
17
|
+
lib/sciruby/data/r.rb
|
18
|
+
lib/sciruby/data/r/base.rb
|
19
|
+
lib/sciruby/data/r/data_frame.rb
|
20
|
+
lib/sciruby/data/r/grouped_data.rb
|
21
|
+
lib/sciruby/data/r/list.rb
|
22
|
+
lib/sciruby/data/r/multi_time_series.rb
|
23
|
+
lib/sciruby/data/r/r_matrix.rb
|
24
|
+
lib/sciruby/data/r/time_series.rb
|
25
|
+
lib/sciruby/data/r/time_series_base.rb
|
26
|
+
lib/sciruby/data/r/vector.rb
|
27
|
+
lib/ext/shoes.rb
|
28
|
+
lib/ext/csv.rb
|
29
|
+
lib/ext/string.rb
|
30
|
+
bin/sciruby-plotter
|
31
|
+
static/sciruby-icon.png
|
32
|
+
test/test_recommend.rb
|
33
|
+
test/helpers_tests.rb
|
34
|
+
data/r/man/ability.cov.Rd
|
35
|
+
data/r/man/airmiles.Rd
|
36
|
+
data/r/man/AirPassengers.Rd
|
37
|
+
data/r/man/airquality.Rd
|
38
|
+
data/r/man/anscombe.Rd
|
39
|
+
data/r/man/attenu.Rd
|
40
|
+
data/r/man/attitude.Rd
|
41
|
+
data/r/man/austres.Rd
|
42
|
+
data/r/man/beavers.Rd
|
43
|
+
data/r/man/BJsales.Rd
|
44
|
+
data/r/man/BOD.Rd
|
45
|
+
data/r/man/cars.Rd
|
46
|
+
data/r/man/ChickWeight.Rd
|
47
|
+
data/r/man/chickwts.Rd
|
48
|
+
data/r/man/co2.Rd
|
49
|
+
data/r/man/crimtab.Rd
|
50
|
+
data/r/man/datasets-package.Rd
|
51
|
+
data/r/man/discoveries.Rd
|
52
|
+
data/r/man/DNase.Rd
|
53
|
+
data/r/man/esoph.Rd
|
54
|
+
data/r/man/eurodist.Rd
|
55
|
+
data/r/man/euro.Rd
|
56
|
+
data/r/man/EuStockMarkets.Rd
|
57
|
+
data/r/man/faithful.Rd
|
58
|
+
data/r/man/Formaldehyde.Rd
|
59
|
+
data/r/man/freeny.Rd
|
60
|
+
data/r/man/HairEyeColor.Rd
|
61
|
+
data/r/man/Harman23.cor.Rd
|
62
|
+
data/r/man/Harman74.cor.Rd
|
63
|
+
data/r/man/Indometh.Rd
|
64
|
+
data/r/man/infert.Rd
|
65
|
+
data/r/man/InsectSprays.Rd
|
66
|
+
data/r/man/iris.Rd
|
67
|
+
data/r/man/islands.Rd
|
68
|
+
data/r/man/JohnsonJohnson.Rd
|
69
|
+
data/r/man/LakeHuron.Rd
|
70
|
+
data/r/man/lh.Rd
|
71
|
+
data/r/man/LifeCycleSavings.Rd
|
72
|
+
data/r/man/Loblolly.Rd
|
73
|
+
data/r/man/longley.Rd
|
74
|
+
data/r/man/lynx.Rd
|
75
|
+
data/r/man/morley.Rd
|
76
|
+
data/r/man/mtcars.Rd
|
77
|
+
data/r/man/nhtemp.Rd
|
78
|
+
data/r/man/Nile.Rd
|
79
|
+
data/r/man/nottem.Rd
|
80
|
+
data/r/man/occupationalStatus.Rd
|
81
|
+
data/r/man/Orange.Rd
|
82
|
+
data/r/man/OrchardSprays.Rd
|
83
|
+
data/r/man/PlantGrowth.Rd
|
84
|
+
data/r/man/precip.Rd
|
85
|
+
data/r/man/presidents.Rd
|
86
|
+
data/r/man/pressure.Rd
|
87
|
+
data/r/man/Puromycin.Rd
|
88
|
+
data/r/man/quakes.Rd
|
89
|
+
data/r/man/randu.Rd
|
90
|
+
data/r/man/rivers.Rd
|
91
|
+
data/r/man/rock.Rd
|
92
|
+
data/r/man/sleep.Rd
|
93
|
+
data/r/man/stackloss.Rd
|
94
|
+
data/r/man/state.Rd
|
95
|
+
data/r/man/sunspot.month.Rd
|
96
|
+
data/r/man/sunspots.Rd
|
97
|
+
data/r/man/sunspot.year.Rd
|
98
|
+
data/r/man/swiss.Rd
|
99
|
+
data/r/man/Theoph.Rd
|
100
|
+
data/r/man/Titanic.Rd
|
101
|
+
data/r/man/ToothGrowth.Rd
|
102
|
+
data/r/man/treering.Rd
|
103
|
+
data/r/man/trees.Rd
|
104
|
+
data/r/man/UCBAdmissions.Rd
|
105
|
+
data/r/man/UKDriverDeaths.Rd
|
106
|
+
data/r/man/UKgas.Rd
|
107
|
+
data/r/man/UKLungDeaths.Rd
|
108
|
+
data/r/man/USAccDeaths.Rd
|
109
|
+
data/r/man/USArrests.Rd
|
110
|
+
data/r/man/USJudgeRatings.Rd
|
111
|
+
data/r/man/USPersonalExpenditure.Rd
|
112
|
+
data/r/man/uspop.Rd
|
113
|
+
data/r/man/VADeaths.Rd
|
114
|
+
data/r/man/volcano.Rd
|
115
|
+
data/r/man/warpbreaks.Rd
|
116
|
+
data/r/man/women.Rd
|
117
|
+
data/r/man/WorldPhones.Rd
|
118
|
+
data/r/man/WWWusage.Rd
|
119
|
+
data/r/man/zCO2.Rd
|
data/Rakefile
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# -*- ruby -*-
|
3
|
+
# -*- coding: utf-8 -*-
|
4
|
+
$:.unshift(File.dirname(__FILE__)+'/lib/')
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'rdoc/task'
|
8
|
+
require 'sciruby'
|
9
|
+
require 'hoe'
|
10
|
+
|
11
|
+
# Hoe.plugin :compiler
|
12
|
+
# Hoe.plugin :cucumberfeatures
|
13
|
+
# Hoe.plugin :gem_prelude_sucks
|
14
|
+
Hoe.plugin :git
|
15
|
+
Hoe.plugin :gemspec
|
16
|
+
Hoe.plugin :bundler
|
17
|
+
# Hoe.plugin :inline
|
18
|
+
# Hoe.plugin :manifest
|
19
|
+
# Hoe.plugin :newgem
|
20
|
+
# Hoe.plugin :racc
|
21
|
+
# Hoe.plugin :rubyforge
|
22
|
+
# Hoe.plugin :website
|
23
|
+
|
24
|
+
desc "Ruby Lint"
|
25
|
+
task :lint do
|
26
|
+
executable=Config::CONFIG['RUBY_INSTALL_NAME']
|
27
|
+
Dir.glob("lib/**/*.rb") {|f|
|
28
|
+
if !system %{#{executable} -w -c "#{f}"}
|
29
|
+
puts "Error on: #{f}"
|
30
|
+
end
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Open an irb session preloaded with sciruby"
|
35
|
+
task :console do
|
36
|
+
sh "irb -rubygems -I lib -r sciruby.rb"
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Start the plotter without the console"
|
40
|
+
task :plotter, [:script] => [] do |t,args|
|
41
|
+
if args.script.empty?
|
42
|
+
raise ArgumentError, "Need a script, e.g.: rake plotter[script.rb]"
|
43
|
+
else
|
44
|
+
sh "ruby -rubygems -I lib -r sciruby.rb -e 'SciRuby::Plotter.new(\"#{args.script}\")'"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "Start the plotter without the console"
|
49
|
+
task :editor do
|
50
|
+
sh "ruby -rubygems -I lib -r sciruby.rb -e 'SciRuby::Editor.new'"
|
51
|
+
end
|
52
|
+
|
53
|
+
task :release do
|
54
|
+
system %{git push origin master}
|
55
|
+
end
|
56
|
+
|
57
|
+
h = Hoe.spec 'sciruby' do
|
58
|
+
self.version = SciRuby::VERSION
|
59
|
+
self.require_ruby_version ">=1.9"
|
60
|
+
self.developer('SciRuby Development Team', 'sciruby-dev@googlegroups.com')
|
61
|
+
self.extra_deps = {'distribution' => ">=0.4.0",
|
62
|
+
'green_shoes' => ">=1.0.282",
|
63
|
+
'statsample' => ">=1.1.0",
|
64
|
+
'integration' => ">= 0",
|
65
|
+
'minimization' => ">= 0",
|
66
|
+
'gsl' => "~> 1.14.5",
|
67
|
+
'rsvg2' => '~> 1.0.0',
|
68
|
+
'simpler' => '>=0.1.0',
|
69
|
+
'rubyvis' => '>=0.4.0' }.to_a
|
70
|
+
|
71
|
+
|
72
|
+
self.extra_dev_deps = {'hoe' => "~> 2.12",
|
73
|
+
'rdoc' => ">=0",
|
74
|
+
'rspec' => ">=2.0",
|
75
|
+
'haml' => ">=0", # for Rubyvis
|
76
|
+
'coderay' => ">=0", # for Rubyvis
|
77
|
+
'nokogiri' => ">=0", # for Rubyvis
|
78
|
+
'RedCloth' => ">=0", # for Rubyvis
|
79
|
+
'gtksourceview2' => ">=0", # for editor
|
80
|
+
'shoulda' => "~> 2.11",
|
81
|
+
'hoe-gemspec' => "~> 1.0",
|
82
|
+
'hoe-bundler' => "~> 1.1",
|
83
|
+
'minitest' => "~> 2.0" }.to_a
|
84
|
+
|
85
|
+
#self.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
86
|
+
|
87
|
+
self.post_install_message = <<-EOF
|
88
|
+
***********************************************************
|
89
|
+
Welcome to SciRuby: Tools for Scientific Computing in Ruby!
|
90
|
+
|
91
|
+
*** WARNING ***
|
92
|
+
Please be aware that SciRuby is in ALPHA status. If you're
|
93
|
+
thinking of using SciRuby to write mission critical code,
|
94
|
+
such as for driving a car or flying a space shuttle, you
|
95
|
+
may wish to choose other software (for now).
|
96
|
+
|
97
|
+
In order to leverage the GUI features, you will need to
|
98
|
+
install gtk2 and optionally gtksourceview2:
|
99
|
+
|
100
|
+
$ gem install gtk2 gtksourceview2
|
101
|
+
|
102
|
+
You will probably first need to install the headers for
|
103
|
+
a number of required packages. In Ubuntu, use:
|
104
|
+
|
105
|
+
$ sudo apt-get install libgtk2.0-dev libgtksourceview2-dev \\
|
106
|
+
librsvg2-dev libcairo2-dev
|
107
|
+
|
108
|
+
If you have trouble with Green Shoes, you should look at
|
109
|
+
the Green Shoes wiki:
|
110
|
+
|
111
|
+
* http://github.com/ashbb/green_shoes/wiki
|
112
|
+
|
113
|
+
For Mac OSX Green Shoes:
|
114
|
+
|
115
|
+
* https://github.com/ashbb/green_shoes/wiki/Building-Green-Shoes-on-OSX
|
116
|
+
|
117
|
+
More explicit instructions for SciRuby should be available
|
118
|
+
at our website, sciruby.com, or through our mailing list
|
119
|
+
(which can also be found on our website).
|
120
|
+
|
121
|
+
Thanks for installing SciRuby! Happy hypothesis testing!
|
122
|
+
|
123
|
+
***********************************************************
|
124
|
+
EOF
|
125
|
+
|
126
|
+
self.need_rdoc = false
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
RDoc::Task.new(:docs) do |rd|
|
131
|
+
rd.main = h.readme_file
|
132
|
+
rd.options << '-d' if (`which dot` =~ /\/dot/) unless
|
133
|
+
ENV['NODOT'] || Hoe::WINDOZE
|
134
|
+
rd.rdoc_dir = 'doc'
|
135
|
+
|
136
|
+
rd.rdoc_files.include("lib/**/*.rb")
|
137
|
+
rd.rdoc_files += h.spec.extra_rdoc_files
|
138
|
+
rd.rdoc_files.reject! {|f| f=="Manifest.txt"}
|
139
|
+
title = h.spec.rdoc_options.grep(/^(-t|--title)=?$/).first
|
140
|
+
if title then
|
141
|
+
rd.options << title
|
142
|
+
|
143
|
+
unless title =~ /\=/ then # for ['-t', 'title here']
|
144
|
+
title_index = spec.rdoc_options.index(title)
|
145
|
+
rd.options << spec.rdoc_options[title_index + 1]
|
146
|
+
end
|
147
|
+
else
|
148
|
+
title = "#{h.name}-#{h.version} Documentation"
|
149
|
+
title = "#{h.rubyforge_name}'s " + title if h.rubyforge_name != h.name
|
150
|
+
rd.options << '--title' << title
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
desc 'Publish rdocs with analytics support'
|
155
|
+
task :publish_docs => [:clean, :docs] do
|
156
|
+
ruby %{aggregate_adsense_to_doc.rb}
|
157
|
+
path = File.expand_path("~/.rubyforge/user-config.yml")
|
158
|
+
config = YAML.load(File.read(path))
|
159
|
+
host = "#{config["username"]}@rubyforge.org"
|
160
|
+
|
161
|
+
remote_dir = "/var/www/gforge-projects/#{h.rubyforge_name}/#{h.remote_rdoc_dir
|
162
|
+
}"
|
163
|
+
local_dir = h.local_rdoc_dir
|
164
|
+
Dir.glob(local_dir+"/**/*") {|file|
|
165
|
+
sh %{chmod 755 #{file}}
|
166
|
+
}
|
167
|
+
sh %{rsync #{h.rsync_args} #{local_dir}/ #{host}:#{remote_dir}}
|
168
|
+
end
|
169
|
+
|
170
|
+
require 'rspec/core/rake_task'
|
171
|
+
namespace :spec do
|
172
|
+
desc "Run all specs"
|
173
|
+
RSpec::Core::RakeTask.new
|
174
|
+
# options in .rspec in package root
|
175
|
+
end
|
176
|
+
|
177
|
+
|
178
|
+
# vim: syntax=ruby
|
data/bin/sciruby-plotter
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
% File src/library/datasets/man/AirPassengers.Rd
|
2
|
+
% Part of the R package, http://www.R-project.org
|
3
|
+
% Copyright 1995-2007 R Core Development Team
|
4
|
+
% Distributed under GPL 2 or later
|
5
|
+
|
6
|
+
\name{AirPassengers}
|
7
|
+
\docType{data}
|
8
|
+
\alias{AirPassengers}
|
9
|
+
\title{Monthly Airline Passenger Numbers 1949-1960}
|
10
|
+
\description{
|
11
|
+
The classic Box & Jenkins airline data. Monthly totals of
|
12
|
+
international airline passengers, 1949 to 1960.
|
13
|
+
}
|
14
|
+
\usage{AirPassengers}
|
15
|
+
\format{
|
16
|
+
A monthly time series, in thousands.
|
17
|
+
}
|
18
|
+
\source{
|
19
|
+
Box, G. E. P., Jenkins, G. M. and Reinsel, G. C. (1976)
|
20
|
+
\emph{Time Series Analysis, Forecasting and Control.}
|
21
|
+
Third Edition. Holden-Day. Series G.
|
22
|
+
}
|
23
|
+
\examples{
|
24
|
+
\dontrun{
|
25
|
+
## These are quite slow and so not run by example(AirPassengers)
|
26
|
+
|
27
|
+
## The classic 'airline model', by full ML
|
28
|
+
(fit <- arima(log10(AirPassengers), c(0, 1, 1),
|
29
|
+
seasonal = list(order=c(0, 1 ,1), period=12)))
|
30
|
+
update(fit, method = "CSS")
|
31
|
+
update(fit, x=window(log10(AirPassengers), start = 1954))
|
32
|
+
pred <- predict(fit, n.ahead = 24)
|
33
|
+
tl <- pred$pred - 1.96 * pred$se
|
34
|
+
tu <- pred$pred + 1.96 * pred$se
|
35
|
+
ts.plot(AirPassengers, 10^tl, 10^tu, log = "y", lty = c(1,2,2))
|
36
|
+
|
37
|
+
## full ML fit is the same if the series is reversed, CSS fit is not
|
38
|
+
ap0 <- rev(log10(AirPassengers))
|
39
|
+
attributes(ap0) <- attributes(AirPassengers)
|
40
|
+
arima(ap0, c(0, 1, 1), seasonal = list(order=c(0, 1 ,1), period=12))
|
41
|
+
arima(ap0, c(0, 1, 1), seasonal = list(order=c(0, 1 ,1), period=12),
|
42
|
+
method = "CSS")
|
43
|
+
|
44
|
+
## Structural Time Series
|
45
|
+
ap <- log10(AirPassengers) - 2
|
46
|
+
(fit <- StructTS(ap, type= "BSM"))
|
47
|
+
par(mfrow=c(1,2))
|
48
|
+
plot(cbind(ap, fitted(fit)), plot.type = "single")
|
49
|
+
plot(cbind(ap, tsSmooth(fit)), plot.type = "single")
|
50
|
+
}}
|
51
|
+
\keyword{datasets}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
% File src/library/datasets/man/BJsales.Rd
|
2
|
+
% Part of the R package, http://www.R-project.org
|
3
|
+
% Copyright 1995-2007 R Core Development Team
|
4
|
+
% Distributed under GPL 2 or later
|
5
|
+
|
6
|
+
\name{BJsales}
|
7
|
+
\docType{data}
|
8
|
+
\alias{BJsales}
|
9
|
+
\alias{BJsales.lead}
|
10
|
+
\title{Sales Data with Leading Indicator}
|
11
|
+
\description{
|
12
|
+
The sales time series \code{BJsales} and leading indicator
|
13
|
+
\code{BJsales.lead} each contain 150 observations.
|
14
|
+
The objects are of class \code{"ts"}.
|
15
|
+
}
|
16
|
+
\usage{
|
17
|
+
BJsales
|
18
|
+
BJsales.lead
|
19
|
+
}
|
20
|
+
\source{
|
21
|
+
The data are given in Box & Jenkins (1976).
|
22
|
+
Obtained from the Time Series Data Library at
|
23
|
+
\url{http://www-personal.buseco.monash.edu.au/~hyndman/TSDL/}
|
24
|
+
}
|
25
|
+
\references{
|
26
|
+
G. E. P. Box and G. M. Jenkins (1976):
|
27
|
+
\emph{Time Series Analysis, Forecasting and Control},
|
28
|
+
Holden-Day, San Francisco, p. 537.
|
29
|
+
|
30
|
+
P. J. Brockwell and R. A. Davis (1991):
|
31
|
+
\emph{Time Series: Theory and Methods},
|
32
|
+
Second edition, Springer Verlag, NY, pp. 414.
|
33
|
+
}
|
34
|
+
\keyword{datasets}
|
data/data/r/man/BOD.Rd
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
% File src/library/datasets/man/BOD.Rd
|
2
|
+
% Part of the R package, http://www.R-project.org
|
3
|
+
% Copyright 1995-2010 R Core Development Team
|
4
|
+
% Distributed under GPL 2 or later
|
5
|
+
|
6
|
+
\name{BOD}
|
7
|
+
\docType{data}
|
8
|
+
\alias{BOD}
|
9
|
+
\title{ Biochemical Oxygen Demand }
|
10
|
+
\description{
|
11
|
+
The \code{BOD} data frame has 6 rows and 2 columns giving the
|
12
|
+
biochemical oxygen demand versus time in an evaluation of water
|
13
|
+
quality.
|
14
|
+
}
|
15
|
+
\usage{BOD}
|
16
|
+
\format{
|
17
|
+
This data frame contains the following columns:
|
18
|
+
\describe{
|
19
|
+
\item{Time}{
|
20
|
+
A numeric vector giving the time of the measurement (days).
|
21
|
+
}
|
22
|
+
\item{demand}{
|
23
|
+
A numeric vector giving the biochemical oxygen demand (mg/l).
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
\source{
|
28
|
+
Bates, D.M. and Watts, D.G. (1988),
|
29
|
+
\emph{Nonlinear Regression Analysis and Its Applications},
|
30
|
+
Wiley, Appendix A1.4.
|
31
|
+
|
32
|
+
Originally from Marske (1967), \emph{Biochemical
|
33
|
+
Oxygen Demand Data Interpretation Using Sum of Squares Surface}
|
34
|
+
M.Sc. Thesis, University of Wisconsin -- Madison.
|
35
|
+
}
|
36
|
+
\examples{
|
37
|
+
\testonly{options(show.nls.convergence=FALSE)
|
38
|
+
old <- options(digits = 5)}
|
39
|
+
require(stats)
|
40
|
+
# simplest form of fitting a first-order model to these data
|
41
|
+
fm1 <- nls(demand ~ A*(1-exp(-exp(lrc)*Time)), data = BOD,
|
42
|
+
start = c(A = 20, lrc = log(.35)))
|
43
|
+
coef(fm1)
|
44
|
+
fm1
|
45
|
+
# using the plinear algorithm
|
46
|
+
fm2 <- nls(demand ~ (1-exp(-exp(lrc)*Time)), data = BOD,
|
47
|
+
start = c(lrc = log(.35)), algorithm = "plinear", trace = TRUE)
|
48
|
+
# using a self-starting model
|
49
|
+
fm3 <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
|
50
|
+
summary(fm3)
|
51
|
+
\testonly{options(old)}
|
52
|
+
}
|
53
|
+
\keyword{datasets}
|