Module: Daru::Accessors::GSLStatistics
- Included in:
- GSLWrapper
- Defined in:
- lib/daru/accessors/gsl_wrapper.rb
Instance Method Summary collapse
- #kurtosis ⇒ Object
- #median ⇒ Object
- #sample_with_replacement(sample = 1) ⇒ Object
- #sample_without_replacement(sample = 1) ⇒ Object
- #skew ⇒ Object
- #standard_deviation_population(m) ⇒ Object
- #standard_deviation_sample(m) ⇒ Object
- #variance_population(m) ⇒ Object
- #variance_sample(m) ⇒ Object
- #vector_centered_compute(m) ⇒ Object
- #vector_standardized_compute(m, sd) ⇒ Object
Instance Method Details
#kurtosis ⇒ Object
50 51 52 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 50 def kurtosis @data.kurtosis end |
#median ⇒ Object
26 27 28 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 26 def median GSL::Stats.median_from_sorted_data(@data.sort) end |
#sample_with_replacement(sample = 1) ⇒ Object
15 16 17 18 19 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 15 def sample_with_replacement(sample=1) r = GSL::Rng.alloc(GSL::Rng::MT19937,rand(10_000)) Daru::Vector.new(r.sample(@data, sample).to_a, dtype: :gsl, index: @context.index, name: @context.name) end |
#sample_without_replacement(sample = 1) ⇒ Object
21 22 23 24 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 21 def sample_without_replacement(sample=1) r = GSL::Rng.alloc(GSL::Rng::MT19937,rand(10_000)) r.choose(@data, sample).to_a end |
#skew ⇒ Object
46 47 48 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 46 def skew @data.skew end |
#standard_deviation_population(m) ⇒ Object
42 43 44 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 42 def standard_deviation_population m @data.sd_with_fixed_mean(m) end |
#standard_deviation_sample(m) ⇒ Object
34 35 36 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 34 def standard_deviation_sample(m) @data.sd(m) end |
#variance_population(m) ⇒ Object
38 39 40 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 38 def variance_population(m) @data.variance_with_fixed_mean(m) end |
#variance_sample(m) ⇒ Object
30 31 32 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 30 def variance_sample(m) @data.variance(m) end |