Method: Statsample::DominanceAnalysis::Bootstrap#bootstrap

Defined in:
lib/statsample/dominanceanalysis/bootstrap.rb

#bootstrap(number_samples, n = nil) ⇒ Object

Creates n re-samples from original dataset and store result of each sample on @samples_td, @samples_cd, @samples_gd, @samples_ga

  • number_samples: Number of new samples to add

  • n: size of each new sample. If nil, equal to original sample size


134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/statsample/dominanceanalysis/bootstrap.rb', line 134

def bootstrap(number_samples,n=nil)
  number_samples.times{ |t|
    @n_samples+=1
    puts _("Bootstrap %d of %d") % [t+1, number_samples] if @debug
    ds_boot=@ds.bootstrap(n)                 
    da_1=DominanceAnalysis.new(ds_boot, @y_var, :regression_class => @regression_class)

    da_1.total_dominance.each{|k,v|
      @samples_td[k].push(v)
    }
    da_1.conditional_dominance.each{|k,v|
      @samples_cd[k].push(v)
    }
    da_1.general_dominance.each{|k,v|
      @samples_gd[k].push(v)
    }
    da_1.general_averages.each{|k,v|
      @samples_ga[k].push(v)
    }
  }
end