Sha256: 63c7ef0d69fbc3490b11ee59e99b9329d3d29dd3c90e925b999647b1843bbbc8

Contents?: true

Size: 721 Bytes

Versions: 6

Compression:

Stored size: 721 Bytes

Contents

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

# == Description
#
# Dominance Analysis with statsample
require 'statsample'
Statsample::Analysis.store(Statsample::DominanceAnalysis) do
  sample=300
  a=rnorm(sample)
  b=rnorm(sample)
  c=rnorm(sample)
  d=rnorm(sample)
  
  ds = Daru::DataFrame.new({:a => a,:b => b,:cc => c,:d => d}, clone: false)
  attach(ds)
  ds[:y]=a*5 + b*3 + cc*2 + d + rnorm(300)
  cm=cor(ds)
  summary(cm)
  lr=lr(ds,:y)
  summary(lr)
  da=dominance_analysis(ds,:y)
  summary(da)
  
  da = dominance_analysis(ds,:y,:name=>"Dominance Analysis using group of predictors", :predictors=>[:a, :b, [:cc, :d]])
  summary(da)
end


if __FILE__==$0
  Statsample::Analysis.run_batch
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
statsample-ekatena-2.0.2.1 examples/dominance_analysis.rb
statsample-ekatena-2.0.2 examples/dominance_analysis.rb
statsample-2.1.0 examples/dominance_analysis.rb
statsample-2.0.2 examples/dominance_analysis.rb
statsample-2.0.1 examples/dominance_analysis.rb
statsample-2.0.0 examples/dominance_analysis.rb