Method: Statsample::DominanceAnalysis::Bootstrap#initialize
- Defined in:
- lib/statsample/dominanceanalysis/bootstrap.rb
permalink #initialize(ds, y_var, opts = Hash.new) ⇒ Bootstrap
Create a new Dominance Analysis Bootstrap Object
-
ds: A Daru::DataFrame object
-
y_var: Name of dependent variable
-
opts: Any other attribute of the class
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/statsample/dominanceanalysis/bootstrap.rb', line 97 def initialize(ds,y_var, opts=Hash.new) @ds = ds @y_var = y_var.respond_to?(:to_sym) ? y_var.to_sym : y_var @n = ds.nrows @n_samples=0 @alpha=ALPHA @debug=false if y_var.is_a? Array @fields=ds.vectors.to_a - y_var @regression_class=Regression::Multiple::MultipleDependent else @fields=ds.vectors.to_a - [y_var] @regression_class=Regression::Multiple::MatrixEngine end @samples_ga=@fields.inject({}) { |a,v| a[v]=[]; a } @name=_("Bootstrap dominance Analysis: %s over %s") % [ ds.vectors.to_a.join(",") , @y_var] opts.each{|k,v| self.send("#{k}=",v) if self.respond_to? k } create_samples_pairs end |