Method: Math#variance_population

Defined in:
lib/openc3/core_ext/math.rb

#variance_population(array) ⇒ Float

Calculates the population variance of a group of numbers. If the population is finite the population variance is the variance of the underlying probability distribution.

Parameters:

Returns:

  • (Float, Float)

    The first value is the mean and the second is the variance



56
57
58
59
60
61
62
63
# File 'lib/openc3/core_ext/math.rb', line 56

def variance_population(array)
  mean, m2, num_values = variance_generic(array)
  if num_values != 0.0
    return [mean, m2 / num_values]
  else
    return [mean, 0.0]
  end
end