def event_distribution(treatment, event)
      experiment = treatment.experiment
      result = redis.hvals("experiments:#{experiment.id}:treatments:#{treatment.index}:events:#{event}")
      distribution = result.map(&:to_i).reduce([]) do |arr, ct|
        arr[ct] ||= 0
        arr[ct]  += 1
        arr.map { |i| i || 0 }
      end
      distribution[0] = treatment_size(treatment) - unique_events(treatment, event)
      distribution
    end
def event_distribution(treatment, event)
      experiment = treatment.experiment
      result = redis.hvals("experiments:#{experiment.id}:treatments:#{treatment.index}:events:#{event}")
      distribution = result.map(&:to_i).reduce([]) do |arr, ct|
        arr[ct] ||= 0
        arr[ct]  += 1
        arr.map { |i| i || 0 }
      end
      distribution[0] = treatment_size(treatment) - unique_events(treatment, event)
      distribution
    end
FIXME: this is linear on the number of subjects; could fix by tracking the
 distribution separately, and using the events hash to figure out how to
 alter the distribution in the face of new events (get old count, increment
 the user's count, decrement distribution at old count, increment at new)
 this fix would make this method linear on the cardinality of the
 distribution, rather than the number of subjects, which is probably the
 smaller value in most cases.