Sha256: fa6e2367d2f2cceb0f11d5b2fb2fea001a8056298f00f8c4f83d7c248d54b94a

Contents?: true

Size: 781 Bytes

Versions: 3

Compression:

Stored size: 781 Bytes

Contents

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

require 'statsample'
sample=200
a=sample.times.collect {rand}.to_scale
b=sample.times.collect {rand}.to_scale
c=sample.times.collect {rand}.to_scale
d=sample.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'] + rand()}
rb=ReportBuilder.new(:name=>"Dominance Analysis")

cm=Statsample::Bivariate.correlation_matrix(ds)
rb.add(cm)
lr=Statsample::Regression::Multiple::RubyEngine.new(ds,'y')
rb.add(lr)

#da=Statsample::DominanceAnalysis.new(ds,'y')
#rb.add(da)

da=Statsample::DominanceAnalysis.new(ds,'y',:name=>"Dominance Analysis using group of predictors", :predictors=>['a', 'b', %w{c d}])
rb.add(da)

puts rb.to_text

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
statsample-0.18.0 examples/dominance_analysis.rb
statsample-0.17.0 examples/dominance_analysis.rb
statsample-0.16.0 examples/dominance_analysis.rb