function auditGroupCountOfMedianLhr(groupId, type) {
  return lhrs => {
    const [medianLhr] = computeRepresentativeRuns([lhrs.map(lhr => [lhr, lhr])]);
    if (!medianLhr) return {value: -1};

    // Start out with -1 as "no data available"
    let count = -1;
    for (const category of Object.values(medianLhr.categories)) {
      for (const auditRef of category.auditRefs || []) {
        if (auditRef.group !== groupId) continue;
        const audit = medianLhr.audits[auditRef.id];
        if (!audit) continue;

        // Once we find our first candidate audit, set the count to 0.
        if (count === -1) count = 0;

        const {score, scoreDisplayMode} = audit;
        if (scoreDisplayMode === 'informative' && type === 'na') count++;
        if (scoreDisplayMode === 'notApplicable' && type === 'na') count++;
        if (scoreDisplayMode === 'binary' && score === 1 && type === 'pass') count++;
        if (scoreDisplayMode === 'binary' && score !== 1 && type === 'fail') count++;
        if (scoreDisplayMode === 'error' && type === 'fail') count++;
      }
    }

    return {value: count};
  };
}
@param {string} groupId
@param {'pass'|'fail'|'na'} type
@return {StatisticFn}