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
49 50 51 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 49 def kurtosis @data.kurtosis end |
#median ⇒ Object
25 26 27 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 25 def median GSL::Stats::median_from_sorted_data(@data.sort) end |
#sample_with_replacement(sample = 1) ⇒ Object
14 15 16 17 18 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 14 def sample_with_replacement(sample=1) r = GSL::Rng.alloc(GSL::Rng::MT19937,rand(10000)) Daru::Vector.new(r.sample(@data, sample).to_a, dtype: :gsl, index: @context.index, name: @context.name) end |
#sample_without_replacement(sample = 1) ⇒ Object
20 21 22 23 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 20 def sample_without_replacement(sample=1) r = GSL::Rng.alloc(GSL::Rng::MT19937,rand(10000)) r.choose(@data, sample).to_a end |
#skew ⇒ Object
45 46 47 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 45 def skew @data.skew end |
#standard_deviation_population(m) ⇒ Object
41 42 43 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 41 def standard_deviation_population m @data.sd_with_fixed_mean(m) end |
#standard_deviation_sample(m) ⇒ Object
33 34 35 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 33 def standard_deviation_sample(m) @data.sd(m) end |
#variance_population(m) ⇒ Object
37 38 39 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 37 def variance_population(m) @data.variance_with_fixed_mean(m) end |
#variance_sample(m) ⇒ Object
29 30 31 |
# File 'lib/daru/accessors/gsl_wrapper.rb', line 29 def variance_sample(m) @data.variance_m end |