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

Instance Method Details

#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



110
111
112
# File 'lib/rust-basics.rb', line 110

def cor(d1, d2, **options)
    return cor_test(d1, d2, **options).correlation
end

#cor_test(d1, d2, **options) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/rust-basics.rb', line 114

def cor_test(d1, d2, **options)
    method = options[: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) ⇒ Object



348
349
350
# File 'lib/rust-plots.rb', line 348

def plot(x, y)
    Rust::Plots::ScatterPlot.new(x, y).show
end

#read_csv(filename, **options) ⇒ Object



572
573
574
# File 'lib/rust-core.rb', line 572

def read_csv(filename, **options)
    Rust::CSV.read(filename, **options)
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

#write_csv(filename, dataframe, **options) ⇒ Object



576
577
578
# File 'lib/rust-core.rb', line 576

def write_csv(filename, dataframe, **options)
    Rust::CSV.write(filename, dataframe, **options)
end