Statistical Methods
Mean
Description
Mean is the simple mathematical average of a set of two or more numbers.
The mean for a given set of numbers can be computed in more than one way, including the arithmetic mean method, which uses the sum of the numbers in the series, and the geometric mean method, which is the average of a set of products. However, all the primary methods of computing a simple average produce the same approximate result most of the time.
For more information, please visit Investopedia.
Params & Instance Methods
#initialze @param series [Array] An array of prices, typically closing prices #mean @return [Float] The mean of the price series #valid? @return [Boolean] Whether or not the object is valid
Example
require 'ruby-technical-analysis' series = [0, 1, 2, 3] statistical_methods = RubyTechnicalAnalysis::StatisticalMethods.new( series: series ) p statistical_methods.valid? # true p statistical_methods.mean # 1.5