module Beauvoir::Statistics

Constants

MAGIC_STATISTICS_NUMBER

fancy statistics!

Public Instance Methods

estimated_female_value() click to toggle source
# File lib/beauvoir/statistics.rb, line 24
def estimated_female_value
  estimated_value_formula(@female_count)
end
estimated_male_value() click to toggle source
# File lib/beauvoir/statistics.rb, line 28
def estimated_male_value
  estimated_value_formula(@male_count)
end
estimated_value() click to toggle source
# File lib/beauvoir/statistics.rb, line 32
def estimated_value
  estimated_value_formula([@male_count, @female_count].max)
end
estimated_value_formula(observed) click to toggle source
# File lib/beauvoir/statistics.rb, line 43
def estimated_value_formula(observed)
  nt = total + z ** 2
  (observed + ((z ** 2) / 2)) / nt
end
lower() click to toggle source

returns lower bound of higher of male/female

# File lib/beauvoir/statistics.rb, line 37
def lower
  nt = total + z ** 2
  interval = z * Math.sqrt(estimated_value * (1 - estimated_value) / nt)
  [raw_female_proportion, raw_male_proportion].max - interval
end
z() click to toggle source
# File lib/beauvoir/statistics.rb, line 18
def z
  # TODO: https://github.com/clbustos/statsample/blob/1168d58b14a5095af0a639b4843b31433d40f105/lib/statsample/srs.rb
  #@significance_level #do stuff with this.
  MAGIC_STATISTICS_NUMBER
end