# Function findOutlierWeeks

- findOutlierWeeks(
  buckets: WeekBucket[],
  rateKey: "defectionRate" | "abstentionRate",
  threshold?: number,
  ): OutlierWeek[]

  Find weeks whose `rateKey` value has a z-score ≥ `threshold` against the baseline computed across all buckets (the MEP's own rolling baseline within the period).

  #### Parameters

  - buckets: WeekBucket[]

    Output of bucketByWeek.

  - rateKey: "defectionRate" | "abstentionRate"

    Which rate to evaluate (`'defectionRate'` or `'abstentionRate'`).

  - threshold: number = DEFAULT_Z_SCORE_THRESHOLD

    Minimum z-score that triggers an anomaly (default DEFAULT_Z_SCORE_THRESHOLD).

  #### Returns OutlierWeek[]

  Outlier weeks (chronological order).

  - Defined in utils/votingBaseline.ts:417