quartile3 property

num quartile3

Returns the third quartile.

Implementation

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