Module: Rust::RBindings
- Defined in:
- lib/rust-core.rb,
lib/rust-calls.rb,
lib/rust-plots.rb,
lib/rust-tests.rb,
lib/rust-basics.rb,
lib/rust-effsize.rb
Instance Method Summary collapse
- #boxplot(*args, **options) ⇒ Object
- #cliff_delta(d1, d2) ⇒ Object
- #cohen_d(d1, d2, **args) ⇒ Object
- #cor(d1, d2, **options) ⇒ Object
- #cor_test(d1, d2, **options) ⇒ Object
- #data_frame(*args) ⇒ Object
- #plot(x, y = (1..x.size).to_a, **options) ⇒ Object
- #read_csv(filename, **options) ⇒ Object
- #t_test(d1, d2, **args) ⇒ Object
- #wilcox_test(d1, d2, **args) ⇒ Object
- #write_csv(filename, dataframe, **options) ⇒ Object
Instance Method Details
#boxplot(*args, **options) ⇒ Object
371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/rust-plots.rb', line 371 def boxplot(*args, **) result = Rust::Plots::BoxPlot.new .each do |k, v| result[k] = v end result. args.each do |s| result.series(s) end result.show end |
#cliff_delta(d1, d2) ⇒ Object
72 73 74 |
# File 'lib/rust-effsize.rb', line 72 def cliff_delta(d1, d2) Rust::EffectSize::CliffDelta.compute(d1, d2) end |
#cohen_d(d1, d2, **args) ⇒ Object
76 77 78 |
# File 'lib/rust-effsize.rb', line 76 def cohen_d(d1, d2, **args) Rust::EffectSize::CohenD.compute(d1, d2) end |
#cor(d1, d2, **options) ⇒ Object
116 117 118 |
# File 'lib/rust-basics.rb', line 116 def cor(d1, d2, **) return cor_test(d1, d2, **).correlation end |
#cor_test(d1, d2, **options) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/rust-basics.rb', line 120 def cor_test(d1, d2, **) method = [:method].to_s.downcase if "pearson".start_with?(method) return Rust::Correlation::Pearson.test(d1, d2) elsif "spearman".start_with?(method) return Rust::Correlation::Spearman.test(d1, d2) elsif "kendall".start_with?(method) return Rust::Correlation::Kendall.test(d1, d2) else raise "Unsupported method #{method}" end end |
#data_frame(*args) ⇒ Object
580 581 582 |
# File 'lib/rust-core.rb', line 580 def data_frame(*args) Rust::DataFrame.new(*args) end |
#plot(x, y = (1..x.size).to_a, **options) ⇒ Object
359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/rust-plots.rb', line 359 def plot(x, y=(1..x.size).to_a, **) result = Rust::Plots::ScatterPlot.new(x, y) .each do |k, v| result[k] = v end result. result.show end |
#read_csv(filename, **options) ⇒ Object
572 573 574 |
# File 'lib/rust-core.rb', line 572 def read_csv(filename, **) Rust::CSV.read(filename, **) end |
#t_test(d1, d2, **args) ⇒ Object
157 158 159 160 161 162 163 164 |
# File 'lib/rust-tests.rb', line 157 def t_test(d1, d2, **args) paired = args[:paired] || false if paired return Rust::StatisticalTests::T.paired(d1, d2) else return Rust::StatisticalTests::T.unpaired(d1, d2) end end |
#wilcox_test(d1, d2, **args) ⇒ Object
148 149 150 151 152 153 154 155 |
# File 'lib/rust-tests.rb', line 148 def wilcox_test(d1, d2, **args) paired = args[:paired] || false if paired return Rust::StatisticalTests::Wilcoxon.paired(d1, d2) else return Rust::StatisticalTests::Wilcoxon.unpaired(d1, d2) end end |