Class: DatasetStatistics
- Inherits:
-
Object
- Object
- DatasetStatistics
- Defined in:
- lib/math/dataset_statistics.rb
Overview
singleton class to apply statistic methods to a data series
Class Method Summary collapse
-
.subtract_datasets(first_data, second_data) ⇒ DataSet
singleton method to calculate the differences of two datasets with result[j] = first_data[j] - second[j].
Class Method Details
.subtract_datasets(first_data, second_data) ⇒ DataSet
singleton method to calculate the differences of two datasets with
result[i][j] = first_data[i][j] - second[i][j]
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/math/dataset_statistics.rb', line 16 def self.subtract_datasets(first_data, second_data) result = Array.new() # subtract first_data[i][j] - second_data[i][j] first_data.data.keys.each { |index| first_list = first_data.data[index] second_list = second_data.data[index] line = Array.new() first_list.each_index { |list_index| line << (first_list[list_index] - second_list[list_index]) } result << line } # create new data set and return it DataInput::DataSet.new(result) end |