quartile1 property

num quartile1

Returns the first quartile.

Implementation

num get quartile1 {
  final length = sample.length;
  final halfLength = (length.isOdd) ? length ~/ 2 + 1 : length ~/ 2;
  final q1 = halfLength ~/ 2;
  return (halfLength.isEven)
      ? (sortedSample()[q1 - 1] + sortedSample()[q1]) / 2
      : sortedSample()[q1];
}