mean = data => {
  assert(
    Array.isArray(data) && data.length > 0,
    '`data` must be a non-empty array'
  );
  return data.reduce((acc, d) => acc + d, 0) / data.length;
}
compute mean of an array
@param {Array<Number>} data