Module: Rust::RBindings
- Defined in:
- lib/rust-csv.rb,
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
440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'lib/rust-plots.rb', line 440 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
80 81 82 |
# File 'lib/rust-effsize.rb', line 80 def cliff_delta(d1, d2) Rust::EffectSize::CliffDelta.compute(d1, d2) end |
#cohen_d(d1, d2, **args) ⇒ Object
84 85 86 |
# File 'lib/rust-effsize.rb', line 84 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
822 823 824 |
# File 'lib/rust-core.rb', line 822 def data_frame(*args) Rust::DataFrame.new(*args) end |
#plot(x, y = (1..x.size).to_a, **options) ⇒ Object
428 429 430 431 432 433 434 435 436 437 438 |
# File 'lib/rust-plots.rb', line 428 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
97 98 99 |
# File 'lib/rust-csv.rb', line 97 def read_csv(filename, **) Rust::CSV.read(filename, **) end |
#t_test(d1, d2, **args) ⇒ Object
290 291 292 293 294 295 296 297 |
# File 'lib/rust-tests.rb', line 290 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
281 282 283 284 285 286 287 288 |
# File 'lib/rust-tests.rb', line 281 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 |