A time scale is the temporal resolution used to group and analyze observations. Examining multiple scales can reveal collective outliers hidden at another granularity: hours may look normal while their daily total is unusual. section 12.6.3
Choose and interpret time scales cautiously:
- Compare hours, days, and months when anomalies may emerge only after aggregation. section 12.6.3
- Account for multiple testing: examining many short periods can produce false positives, especially with few records per period. section 12.6.3
- Require enough observations for reliable comparisons; aggregated collective-outlier tests can become more stable when each row summarizes many records. section 12.6.3
Listing 12.4 Creating a table where each row represents one day
purchases_df.groupby(['Date']).agg({
'Count': ['mean', 'sum'],
'Unit Cost': ['mean', 'sum'],
'Total Cost': ['mean', 'sum'],
'Purchase ID': ['count']})
Create one row per day by aggregating purchase counts, costs, and purchase totals. section 12.6.3
Purchase data
Daily aggregation exposes unusual days that hourly inspection may miss. In a calendar-day comparison, the 28th appears unusually high but is not a strong outlier; the 31st is low because it occurs in fewer months. section 12.6.3

