Sha256: 29b36f92525c0ece8da1564505bf7228be136b7691927388248cd0e93a42c28a

Contents?: true

Size: 841 Bytes

Versions: 14

Compression:

Stored size: 841 Bytes

Contents

#!/usr/bin/ruby
#$:.unshift(File.dirname(__FILE__)+'/../lib/')

require 'statsample'
require 'benchmark'
samples=1000
a=samples.times.collect {rand}.to_scale
b=samples.times.collect {rand}.to_scale
c=samples.times.collect {rand}.to_scale
d=samples.times.collect {rand}.to_scale

ds={'a'=>a,'b'=>b,'c'=>c,'d'=>d}.to_dataset
ds['y']=ds.collect{|row| row['a']*5+row['b']*3+row['c']*2+row['d']*1+rand()}

Benchmark.bm(7) do |x|


rb=ReportBuilder.new(:name=>"Multiple Regression Engines")

if Statsample.has_gsl?
  x.report("GSL:") {
  lr=Statsample::Regression::Multiple::GslEngine.new(ds,'y',:name=>"Multiple Regression using GSL")
  rb.add(lr.summary)
  }
end


  x.report("Ruby:") {
  lr=Statsample::Regression::Multiple::RubyEngine.new(ds,'y',:name=>"Multiple Regression using RubyEngine")
  rb.add(lr.summary)
  }
  puts rb.to_text
end



Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
statsample-0.18.0 examples/multiple_regression.rb
statsample-0.17.0 examples/multiple_regression.rb
statsample-0.16.0 examples/multiple_regression.rb
statsample-0.15.1 examples/multiple_regression.rb
statsample-0.15.0 examples/multiple_regression.rb
statsample-0.14.1 examples/multiple_regression.rb
statsample-0.14.0 examples/multiple_regression.rb
statsample-0.13.1 examples/multiple_regression.rb
statsample-0.13.0 examples/multiple_regression.rb
statsample-0.12.0 examples/multiple_regression.rb
statsample-0.11.2 examples/multiple_regression.rb
statsample-0.11.1 examples/multiple_regression.rb
statsample-0.11.0 examples/multiple_regression.rb
statsample-0.10.0 examples/multiple_regression.rb