Skip to content
You Start with one site
Amounts in Start with one site
Control, Measurement & Energy · Course

Daily and Weekly Patterns

Lesson 7 of 10 24 min read
Found this useful?

A borehole pump delivers 28 percent more water this month than last month, and the manager wants to know who is using it. If the answer given is “the users”, the site buys a larger pump. If the true answer is “a broken pipe”, the larger pump only feeds the leak faster. The monthly total cannot separate the two cases, but the shape of an ordinary day can. This lesson shows how to fold weeks of readings into one typical day and one typical week, how to read base load and peak from that picture, and how to separate a slow trend from a pattern that repeats. #TimeSeries #LoadProfile #Seasonality

Learning Objectives

By the end of this lesson, you will be able to:

  1. Build a typical-day profile with its mean and its 10th and 90th percentiles at each hour
  2. Read base load, peak and daily volume from a profile
  3. Distinguish a constant addition (a leak, a standby load) from a proportional rise in use
  4. Calculate a centred moving average and state where it has no value
  5. Split a daily series into trend, weekly seasonal component and remainder

Real-World System Problem: A borehole that pumps more every month



A borehole pump fills a village supply. A flow meter on the discharge pipe logs the flow every hour. Over 60 days the meter shows that the daily volume rose from about 78 m³ to about 100 m³. Nobody changed the pump, and nobody counted the users.

Two explanations fit the totals. More people may be drawing water: then the extra flow appears when people are awake and is nearly absent at night. Or a pipe may have failed: then water leaves through the break at every hour, including 03:00 when every tap is closed. The two cases give the same total and different shapes of day.

The same question appears on every site. A building’s energy is high on some days and low on others: is that the weather, or are some of those days Sundays? Before any model is fitted, the engineer must know what an ordinary day and an ordinary week look like.

FlowmeterBoreholepumpUsersday: highnight: lowLeak (if any):the same at every hour
The borehole, its meter and the two explanations

Fundamental Theory: Profiles, moving averages and decomposition



A pattern that repeats

Most site data repeats with the clock and the calendar. Water use follows the hours of the day. Office energy follows the days of the week. Cooling follows the year. In time series work, any pattern with a fixed, known period is called seasonal, even when the period is one day and has nothing to do with seasons.

A long plot of 1,440 hourly readings hides this repetition. Fold the series instead, like the days of a calendar laid on top of each other: every reading taken at 03:00 in one group, every reading at 04:00 in the next, and describe each group.

The typical-day profile

Write for the reading on day at hour , where runs from 0 to 23 and hour 6 means the hour from 06:00 to 07:00. With days of data, the typical-day profile is the mean at each hour.

Typical-day profile

The profile is 24 numbers. Each is the mean of the readings taken at the same hour of the day.

hour012...2223day 0xxx...xxday 1xxx...xx...day 34xxx...xxmeanone value for each hour: the profile10th, 90th percentile: the band around it
Folding 35 days into one profile

A mean alone hides how much one day differs from the next, so at each hour also take the 10th and the 90th percentile of the same readings: eight days in ten fall between them. A narrow band means the hour is predictable; a wide band means its mean is known less well.

Base load, peak and daily total

Three numbers come directly from a profile.

  • The base load (base flow for water) is the minimum of the profile. It is what the site uses when nobody is asking for anything: leaks, standby power, equipment left on.
  • The peak is the maximum of the profile. It sizes pumps, cables and tariffs.
  • The daily total is the sum of the 24 hourly means, each multiplied by one hour. For flow in m³/h this is a volume in m³. For power in kW it is energy in kWh.

Base load deserves attention because it runs for all 8,760 hours of the year. A base load of 1 kW costs 8,760 kWh a year.

On a real site, three things spoil a profile:

  • Clock changes. Fold by the local clock time when people drive the load. Where clocks change for summer time, every human activity moves by one hour against UTC, and a profile folded in UTC across that date spreads the morning rise over two hours.
  • Holidays and shutdowns. They are not ordinary days. Leave them out, or give them their own profile.
  • Missing hours. Take each hourly mean from the readings that exist, and store how many there were. If hours are missing at random, the sum of the 24 hourly means still gives a fair daily total, while the sum of the readings is too low.

Comparing like with like

A profile is also a rule for fair comparison: compare a reading at 03:00 with other readings at 03:00, and a Tuesday with other Tuesdays. Comparing a Sunday with a Monday reports the weekend, which you already knew, and hides any real change.

To compare two months, compare their profiles hour by hour. The difference at each hour, , has a shape, and the shape names the cause.

Constant additionProportional rise(leak, standby load)(more users, more output)afterafterbeforebeforeafterbeforebothsame gap at every hourgap grows with the load
Two ways for the daily total to rise

A constant addition lifts every hour by the same amount. A proportional rise multiplies every hour by the same factor, adding much at the peak and almost nothing at the base.

The typical week

Daily totals fold in the same way, with a period of 7 days. Number the days of the week from 0 (Monday) to 6 (Sunday) and take the mean of all Mondays, all Tuesdays and so on. For many buildings, two numbers are enough: the mean of weekdays and the mean of weekend days.

The centred moving average

A daily series with a weekly pattern jumps every Saturday. To see the slow movement under those jumps, average over exactly one full period, so that every window holds one Monday, one Tuesday and so on. The pattern then cancels, whatever its shape.

Centred moving average, odd window

For a weekly pattern in daily data, and the window is 7 days: the day itself, 3 days before and 3 days after. is the estimate of the trend on day .

“Centred” means that the window extends equally to both sides, so the average belongs to the middle day. A trailing average (the last 7 days) also removes the weekly pattern, but it reports the level of 3 days ago, so every turn appears late.

The end effect

A centred window needs days on each side. The first days and the last days of the series do not have them, so the trend has no value there.

day01234567...windowtrend for day 3days 0, 1 and 2: no full window, no trend value
The first full 7-day window is centred on day 3

This is not a fault of the software: the trend on the last day depends on days that have not happened yet. Programs that draw a line to the very end have guessed, usually with a shorter or one-sided window, and those last points change when new data arrives. The cost grows with the window: a 7-day window loses 3 days at each end, and a 365-day window loses 182.

Additive decomposition

With the trend known, the series can be written as three parts.

Additive decomposition

is the trend, is the seasonal component (one value for each position in the period, repeated) and is the remainder, the part that neither explains.

The simple method has four steps.

  1. Trend: the centred moving average over one period.
  2. Remove it: .
  3. Seasonal component: the mean of for each day of the week, then subtract the mean of the seven values so that they sum to zero.
  4. Remainder: .

If the remainder is small and without shape, the calendar explains the site. If it is large, something else drives the readings, such as weather or production.

What this simple method assumes

The method assumes that the pattern is stable, with the same seven values of every week of the record, and that it adds to the trend rather than scaling with it. If the weekday step grows when the load grows, a multiplicative form (or the logarithm of the data) fits better. One extreme day changes the trend for 7 days and one seasonal value for the whole record.

A fuller method called STL (Cleveland and others, 1990) allows the seasonal component to change slowly and resists outliers. It is described in the forecasting text listed in the references.

Application 1: Typical day of a borehole, before and after day 35



Step 1: Build the two profiles

Click to reveal the profiles
  1. Arrange the data. Put the 1,440 readings into a table of 60 rows (days) and 24 columns (hours). Rows 0 to 34 are the first period, 35 days. Rows 35 to 59 are the second period, 25 days. ✅

  2. Take the mean of each column. Each value of the first profile is the mean of 35 readings, and each value of the second is the mean of 25 readings. Selected hours, in m³/h:

    HourDays 0 to 3410th90thDays 35 to 59Difference
    00.580.480.671.490.91
    30.590.470.681.500.91
    64.473.855.205.571.10
    94.493.885.445.561.07
    124.463.705.145.420.97
    164.614.015.195.390.78
    214.533.875.385.450.92
    230.620.540.681.480.86

    The script prints all 24 hours. ✅

  3. Read the shape. The first profile has two levels: about 0.6 m³/h from 22:00 to 06:00 and about 4.5 m³/h from 06:00 to 22:00. The second profile has the same two-level shape, lifted. ✅

  4. Read the band. At hour 3 the 10th and 90th percentiles are 0.47 and 0.68 m³/h, a band of 0.21. At hour 12 they are 3.70 and 5.14, a band of 1.44. The night hours give the sharper measurement. ✅

Step 2: The difference at each hour

Click to reveal the difference
  1. Subtract the profiles. The 24 differences have a mean of 0.917 m³/h. The smallest is 0.78 and the largest is 1.10. ✅

  2. Night against day. The mean difference over the 8 night hours is 0.899 m³/h. Over the 16 day hours it is 0.926 m³/h. The two agree within 0.03 m³/h. ✅

  3. Is the scatter by day real? At hour 2, one reading varies by 0.07 m³/h (standard deviation), and the standard error of the difference of the two means is 0.02 m³/h. At hour 12, one reading varies by 0.59 m³/h and the standard error of the difference is 0.16 m³/h. The day differences, from 0.78 to 1.10, all lie within 0.18 of 0.92, about one standard error. The night differences, from 0.86 to 0.92, are known eight times more closely. All 24 hours are consistent with one constant value of about 0.9 m³/h. ✅

  4. Test the other explanation. The daily volume rose by 28.4 percent (Step 3). If use had grown by 28.4 percent at every hour, the night flow would have risen by only 0.17 m³/h and the day flow by 1.29 m³/h. The data shows 0.90 and 0.93. A proportional rise does not fit. ✅

  5. Conclusion. The same 0.9 m³/h was added at every hour, including the hours when nobody draws water. That is the signature of a constant leak and not of extra use. ✅

Step 3: Base flow, peak and daily volume

Click to reveal the three numbers
  1. Base flow. The minimum of the first profile is 0.58 m³/h, at hour 0. The minimum of the second is 1.48 m³/h, at hour 23. The base flow is 2.5 times what it was. ✅

  2. Peak. The maximum of the first profile is 4.73 m³/h at hour 8, and of the second 5.71 m³/h at hour 13. The peak hour moved only because the day hours are nearly equal, so noise decides which is highest. ✅

  3. Daily volume. The sum of the 24 hourly means is

    The rise is 22.0 m³ a day, or 28.4 percent. ✅

  4. Check a second way. A constant 0.917 m³/h for 24 hours is

    This equals the rise in daily volume, so the constant addition explains all of it. The data was generated with a leak of 0.9 m³/h from day 35, which is 21.6 m³ a day. The estimate is within 2 percent of the truth. ✅

Application 2: Weekly pattern and trend of a building’s energy



Step 1: Weekday and weekend

Click to reveal the weekly means
  1. One mean of everything. The mean of all 730 days is 559.2 kWh a day, with a standard deviation of 159.4 kWh. Few days are near 559: the building has two kinds of day. ✅

  2. Two means. The 522 weekdays have a mean of 609.9 kWh. The 208 weekend days have a mean of 431.9 kWh. ✅

  3. The weekday step.

    (The script keeps all digits, so the last figure differs by 0.1 from the rounded subtraction.) A working day costs about 178 kWh more than a rest day. ✅

  4. By day of week. Monday 598.9, Tuesday 622.4, Wednesday 616.3, Thursday 610.0, Friday 601.6, Saturday 434.2, Sunday 429.6 kWh. The five working days are alike and the two rest days are alike, so two groups describe this building well. ✅

Step 2: Centred 7-day moving average

Click to reveal the trend
  1. First window. Days 0 to 6 are one full week. Their mean is the trend for the middle day, day 3.

    The trend on day 3 is 512.7 kWh. ✅

  2. Move the window one day. For day 4, drop day 0 and add day 7. Each window still holds five working days and two rest days, so the weekly pattern cancels. ✅

  3. The end effect. Days 0, 1, 2 and days 727, 728, 729 have no full window. The trend has no value on 6 of the 730 days. ✅

  4. What the trend shows. With the weekly pattern removed, the slow movement is visible. The trend is highest at 816 kWh on day 466 and lowest at 367 kWh on day 627. That swing follows the warm and cool seasons, and it is larger than the weekday step. ✅

  5. A yearly window. To remove the yearly pattern as well, the window must be 365 days. That centred average has no value on 364 of the 730 days: only the middle year remains. Two years of data cannot show a trend free of season except across their middle. ✅

Step 3: Seasonal component and remainder

Click to reveal the decomposition
  1. Remove the trend. Calculate for the 724 days that have a trend value. ✅

  2. Mean deviation by day of week. After the seven means are shifted to sum to zero, the seasonal component is, in kWh:

    MonTueWedThuFriSatSun

    A Saturday is 125.0 kWh below the trend and a Tuesday 64.5 kWh above it. ✅

  3. Remainder for one day. Day 3 is a Thursday.

    (The script, with all digits, prints ; the rounded values above give .) That Thursday used 24.4 kWh less than the trend and the day of the week predict. ✅

  4. Size of the remainder. The standard deviation of the 724 remainders is 56.4 kWh. The raw series had 159.4 kWh. Trend and weekly pattern together account for most of the movement, and 56.4 kWh a day is what the calendar cannot explain. ✅

  5. Check a second way. The mean of the five weekday values of minus the mean of the two weekend values is 178.4 kWh. Step 1 gave 177.9 kWh directly from the means. Two different routes agree within 0.5 kWh. The data was generated with a weekday step of 180 kWh. ✅

  6. Check with a library. seasonal_decompose(energy, period=7, model="additive") from statsmodels (pip install statsmodels) uses the same four steps. It returns the same seven seasonal values, the same trend of 512.7 kWh on day 3, no trend on 6 days, and a remainder with a standard deviation of 56.4 kWh. A hand method that agrees with a library on known data can be trusted on new data. ✅

Daily energy= trend + seasonal + remainderTrendslow level: season, growth, a stepSeasonalthe fixed weekly shape (7 values)Remainderweather of the day, events, faults
What each part of the decomposition answers

Verify It in Python



The script generates both data sets, prints the borehole profile for the two periods, then the weekly means, the centred moving average and the decomposition of the building’s energy. It saves one figure.

profiles_and_weekly_pattern.py
"""Typical-day profile of a borehole and weekly pattern of a building's energy."""
import numpy as np
import matplotlib.pyplot as plt
def borehole_hourly(seed=37, days=60):
rng = np.random.default_rng(seed)
h = np.arange(days * 24); hour = h % 24
demand = np.where((hour >= 6) & (hour < 22), 4.6, 0.6) # m3/h drawn by users
demand = demand * (1.0 + rng.normal(0, 0.12, h.size))
leak = np.where(h >= 35 * 24, 0.9, 0.0) # a leak starts on day 35
flow = np.clip(demand + leak, 0, None) # m3/h
kwh_per_m3 = 0.42 + 0.0006 * (h / 24.0) # slow wear: rising
power = flow * kwh_per_m3 * (1.0 + rng.normal(0, 0.03, h.size)) # kW
return h, flow, power
def building_daily(seed=23, days=730):
rng = np.random.default_rng(seed)
d = np.arange(days)
temp = 21.0 + 4.5 * np.sin(2 * np.pi * (d - 20) / 365.0) + rng.normal(0, 1.6, days)
weekday = (d % 7) < 5 # day 0 is a Monday
cdd = np.clip(temp - 18.0, 0.0, None) # cooling degree days, base 18 °C
energy = 310.0 + 42.0 * cdd + np.where(weekday, 180.0, 0.0) + rng.normal(0, 28.0, days)
# an energy-saving measure is installed on day 500: 12 percent less from then on
energy[500:] *= 0.88
return d, temp, weekday, energy # kWh a day
def centred_average(x, window):
"""Centred moving average for an odd window. The ends are left as NaN."""
k = window // 2
out = np.full(x.size, np.nan)
out[k:x.size - k] = np.convolve(x, np.ones(window) / window, mode="valid")
return out
# ---------- Part 1: data set C, the typical day ----------
h, flow, power = borehole_hourly()
table = flow.reshape(60, 24) # one row a day, one column an hour
early, late = table[:35], table[35:] # days 0 to 34 and days 35 to 59
p_early, p_late = early.mean(axis=0), late.mean(axis=0)
lo, hi = np.percentile(early, 10, axis=0), np.percentile(early, 90, axis=0)
diff = p_late - p_early
print("Borehole: typical day (m3/h)")
print(" hour days 0-34 p10 p90 days 35-59 difference")
for k in range(24):
print(f" {k:4d} {p_early[k]:9.2f} {lo[k]:4.2f} {hi[k]:4.2f} "
f"{p_late[k]:10.2f} {diff[k]:10.2f}")
night = np.r_[22:24, 0:6]
day = np.r_[6:22]
print(f" difference: mean {diff.mean():.3f}, smallest {diff.min():.2f}, "
f"largest {diff.max():.2f}")
print(f" difference: night hours {diff[night].mean():.3f}, "
f"day hours {diff[day].mean():.3f}")
print(f" base flow: {p_early.min():.2f} at hour {p_early.argmin()}, "
f"then {p_late.min():.2f} at hour {p_late.argmin()}")
print(f" peak flow: {p_early.max():.2f} at hour {p_early.argmax()}, "
f"then {p_late.max():.2f} at hour {p_late.argmax()}")
for k in (2, 12):
sd = early[:, k].std(ddof=1)
se = np.sqrt(sd ** 2 / 35 + late[:, k].std(ddof=1) ** 2 / 25)
print(f" hour {k}: one reading varies by {sd:.2f} (standard deviation), "
f"standard error of the difference {se:.2f}")
v_early, v_late = p_early.sum(), p_late.sum()
print(f" daily volume: {v_early:.1f} m3, then {v_late:.1f} m3, "
f"rise {v_late - v_early:.1f} m3 ({100 * (v_late / v_early - 1):.1f} %)")
grow = v_late / v_early - 1.0
print(f" if use had grown {100 * grow:.1f} %: night +{grow * p_early[night].mean():.2f}, "
f"day +{grow * p_early[day].mean():.2f} m3/h")
# ---------- Part 2: data set B, the typical week ----------
d, temp, weekday, energy = building_daily()
dow = d % 7
names = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
print("Building: weekly pattern (kWh a day)")
print(f" mean of all 730 days: {energy.mean():.1f}, "
f"standard deviation {energy.std(ddof=1):.1f}")
print(f" weekdays {int(weekday.sum())}, weekend days {int((~weekday).sum())}")
print(f" weekday mean {energy[weekday].mean():.1f}, weekend mean "
f"{energy[~weekday].mean():.1f}, difference "
f"{energy[weekday].mean() - energy[~weekday].mean():.1f}")
print(" by day of week: " + " ".join(
f"{names[k]} {energy[dow == k].mean():.1f}" for k in range(7)))
trend = centred_average(energy, 7)
print(f" first 7 days: " + " ".join(f"{v:.1f}" for v in energy[:7]))
print(f" trend on day 3: {trend[3]:.1f}; days with no trend value: "
f"{int(np.isnan(trend).sum())}")
detrended = energy - trend
seasonal = np.array([np.nanmean(detrended[dow == k]) for k in range(7)])
seasonal -= seasonal.mean() # make the seven values sum to zero
print(" seasonal component: " + " ".join(
f"{names[k]} {seasonal[k]:+.1f}" for k in range(7)))
step = seasonal[:5].mean() - seasonal[5:].mean()
print(f" weekday minus weekend from the seasonal component: {step:.1f}")
remainder = energy - trend - seasonal[dow]
print(f" day 3: measured {energy[3]:.1f} = trend {trend[3]:.1f} "
f"+ seasonal {seasonal[3]:+.1f} + remainder {remainder[3]:+.1f}")
print(f" remainder standard deviation: {np.nanstd(remainder, ddof=1):.1f}")
print(f" trend: highest {np.nanmax(trend):.0f} on day {np.nanargmax(trend)}, "
f"lowest {np.nanmin(trend):.0f} on day {np.nanargmin(trend)}")
for a, b in ((0, 500), (500, 730)):
e, w = energy[a:b], weekday[a:b]
print(f" days {a} to {b - 1}: weekday minus weekend "
f"{e[w].mean() - e[~w].mean():.1f}")
print(f" a 365-day centred average would have no value on "
f"{int(np.isnan(centred_average(energy, 365)).sum())} of 730 days")
# ---------- Plot ----------
fig, ax = plt.subplots(2, 1, figsize=(8, 7))
hours = np.arange(24)
ax[0].fill_between(hours, lo, hi, step="mid", alpha=0.25,
label="days 0 to 34, 10th to 90th percentile")
ax[0].step(hours, p_early, where="mid", label="days 0 to 34, mean")
ax[0].step(hours, p_late, where="mid", label="days 35 to 59, mean")
ax[0].set_xlabel("hour of day")
ax[0].set_ylabel("flow (m3/h)")
ax[0].set_title("Borehole: typical day")
ax[0].legend()
ax[1].plot(d, energy, linewidth=0.6, label="daily energy")
ax[1].plot(d, trend, linewidth=1.6, label="centred 7-day average")
ax[1].set_xlabel("day")
ax[1].set_ylabel("energy (kWh a day)")
ax[1].set_title("Building: daily energy and its trend")
ax[1].legend()
fig.tight_layout()
fig.savefig("profiles_and_weekly_pattern.png", dpi=120)
print("Saved profiles_and_weekly_pattern.png")

Expected output

Borehole: typical day (m3/h)
hour days 0-34 p10 p90 days 35-59 difference
0 0.58 0.48 0.67 1.49 0.91
1 0.59 0.51 0.68 1.50 0.91
2 0.59 0.51 0.70 1.50 0.90
3 0.59 0.47 0.68 1.50 0.91
4 0.60 0.52 0.67 1.51 0.92
5 0.61 0.51 0.72 1.53 0.91
6 4.47 3.85 5.20 5.57 1.10
7 4.49 3.66 5.23 5.38 0.90
8 4.73 4.22 5.25 5.58 0.85
9 4.49 3.88 5.44 5.56 1.07
10 4.52 3.84 5.26 5.34 0.82
11 4.60 3.83 5.21 5.52 0.92
12 4.46 3.70 5.14 5.42 0.97
13 4.69 3.94 5.30 5.71 1.01
14 4.46 3.74 5.07 5.47 1.01
15 4.47 3.77 5.05 5.28 0.81
16 4.61 4.01 5.19 5.39 0.78
17 4.54 3.83 4.96 5.36 0.81
18 4.53 3.93 5.09 5.55 1.01
19 4.68 4.05 5.29 5.48 0.80
20 4.48 3.98 5.21 5.51 1.03
21 4.53 3.87 5.38 5.45 0.92
22 0.62 0.52 0.70 1.49 0.87
23 0.62 0.54 0.68 1.48 0.86
difference: mean 0.917, smallest 0.78, largest 1.10
difference: night hours 0.899, day hours 0.926
base flow: 0.58 at hour 0, then 1.48 at hour 23
peak flow: 4.73 at hour 8, then 5.71 at hour 13
hour 2: one reading varies by 0.07 (standard deviation), standard error of the difference 0.02
hour 12: one reading varies by 0.59 (standard deviation), standard error of the difference 0.16
daily volume: 77.6 m3, then 99.6 m3, rise 22.0 m3 (28.4 %)
if use had grown 28.4 %: night +0.17, day +1.29 m3/h
Building: weekly pattern (kWh a day)
mean of all 730 days: 559.2, standard deviation 159.4
weekdays 522, weekend days 208
weekday mean 609.9, weekend mean 431.9, difference 177.9
by day of week: Mon 598.9 Tue 622.4 Wed 616.3 Thu 610.0 Fri 601.6 Sat 434.2 Sun 429.6
first 7 days: 549.3 579.3 559.7 538.8 568.2 347.3 446.1
trend on day 3: 512.7; days with no trend value: 6
seasonal component: Mon +41.1 Tue +64.5 Wed +56.6 Thu +50.4 Fri +42.2 Sat -125.0 Sun -129.9
weekday minus weekend from the seasonal component: 178.4
day 3: measured 538.8 = trend 512.7 + seasonal +50.4 + remainder -24.4
remainder standard deviation: 56.4
trend: highest 816 on day 466, lowest 367 on day 627
days 0 to 499: weekday minus weekend 184.7
days 500 to 729: weekday minus weekend 162.1
a 365-day centred average would have no value on 364 of 730 days
Saved profiles_and_weekly_pattern.png

In the upper plot the second profile sits above the first by the same distance at night and by day. In the lower plot the trend line stops 3 days before each end of the record.

Common Mistakes



  • Reporting one mean for a site that has two kinds of hour or two kinds of day. Give the profile, or at least the base and the peak.
  • Comparing two periods by their totals only. Subtract the profiles hour by hour and look at the shape of the difference.
  • Choosing a moving average window that is not one full period. A 5-day or 10-day window on daily data leaves part of the weekly pattern in the trend. Use 7, 14 or 28 days.
  • Trusting the last points of a trend line drawn to the end of the record. A centred average has no value there, and any value shown is a guess that will change.
  • Building a profile across a known change. Fold the periods before and after it separately.

Summary



  • A typical-day profile is the mean of the readings at each hour of the day, with the 10th and 90th percentiles to show how far one day differs from another.
  • The minimum of the profile is the base load, the maximum is the peak, and the sum is the daily total.
  • The difference between two profiles has a shape. In data set C it was about 0.9 m³/h at every hour, 22.0 m³ a day, which identifies a constant leak.
  • A centred moving average over one full period removes the repeating pattern and leaves the trend. It has no value for half a window at each end.
  • The additive decomposition writes each reading as trend plus seasonal component plus remainder. For data set B the weekly step was 178 kWh and the remainder had a standard deviation of 56.4 kWh.
  • The simple method assumes a stable, additive pattern. Check it by repeating the calculation on parts of the record.

Exercises



1. A site’s flow profile is 0.4 m³/h for the 8 night hours and 3.0 m³/h for the 16 day hours. Find the daily volume, the base flow, and the share of the daily volume that the base flow accounts for if it runs for all 24 hours.

Answer

Daily volume: m³. Base flow: 0.4 m³/h, which over 24 hours is 9.6 m³, or percent of the volume.

2. A month later the profile of the same site is 1.0 m³/h at night and 3.6 m³/h by day. Is this a leak or extra use, and how much water is it a day? What would the profile have been if use had grown by 20 percent instead?

Answer

The difference is 0.6 m³/h at night and 0.6 m³/h by day: a constant addition, so a leak, of m³ a day. A 20 percent rise in use would have given 0.48 m³/h at night and 3.6 m³/h by day. The day value alone cannot separate the two cases. The night value does.

3. Daily energy for days 0 to 8 is 520, 540, 530, 550, 525, 350, 340, 535 and 545 kWh. Calculate the centred 7-day moving average for days 3, 4 and 5. For a record of 60 days, on how many days does a centred 7-day average have no value, and a centred 31-day average?

Answer

Day 3: kWh. Day 4: drop 520 and add 535, kWh. Day 5: drop 540 and add 545, kWh. A 7-day window loses 3 days at each end, 6 days in all. A 31-day window loses 15 at each end, 30 days in all, half of the record.

4. After the trend is removed, the mean deviations by day of week are , , , , , and kWh (Monday to Sunday). Adjust them to sum to zero. Then find the remainder for a Saturday on which the trend is 600 kWh and the measured energy is 455 kWh.

Answer

The seven values sum to , so their mean is . Subtract 1 from each: , , , , , , . Remainder: kWh.

5. A building uses a mean of 610 kWh on weekdays and 432 kWh on weekend days, and nothing about it changes. Find the mean daily energy of a month with 23 weekdays and 8 weekend days, and of a month with 20 weekdays and 8 weekend days. What does the difference show?

Answer

First month: kWh a day. Second month: kWh a day. The difference of 4.9 kWh a day (0.9 percent) comes only from the calendar. A claimed saving of about 1 percent between two such months has no meaning unless weekdays and weekend days are compared separately.

References



  • R. J. Hyndman and G. Athanasopoulos, Forecasting: Principles and Practice, 3rd edition, OTexts, 2021. Free at otexts.com/fpp3 (chapter on time series decomposition, including moving averages and STL).
  • R. B. Cleveland, W. S. Cleveland, J. E. McRae and I. Terpenning, “STL: A Seasonal-Trend Decomposition Procedure Based on Loess”, Journal of Official Statistics, vol. 6, no. 1, 1990.
  • D. C. Montgomery, C. L. Jennings and M. Kulahci, Introduction to Time Series Analysis and Forecasting, 2nd edition, Wiley, 2015.


© 2021-2026 SiliconWit®. All rights reserved.
Borehole pump Flow meter Users day: high night: low Leak (if any): the same at every hour
The borehole, its meter and the two explanations
hour 0 6 12 18 23 day 0 day 1 day 2 ... day 33 day 34 mean of each column mean mean: one value for each hour, the profile 10th, 90th percentile: the band around it 0 2 4 6 0 6 12 18 23 hour m³/h band: 10th to 90th
Folding 35 days into one profile
0 1 2 3 4 5 6 7 8 9 ... day window: 7 days, from day 0 to day 6 trend for day 3 days 0, 1 and 2: no full window, no trend value
The first full 7-day window is centred on day 3
Daily energy = trend + seasonal + remainder Trend slow level: season, growth, a step Seasonal the fixed weekly shape (7 values) Remainder weather of the day, events, faults M T W T F S S +64.5 Tue -129.9 Sun sd 56.4 kWh Day 3, a Thursday: 538.8 = 512.7 + 50.4 + (-24.4) kWh
What each part of the decomposition answers
Predict first

A borehole pumps 28 percent more water this month. Either more people use it, or a pipe is broken. Which single number tells the two apart best?

midnightmidnight fold 00:0006:0012:0018:0024:00 thick: mean of 35 daysthin: single days One typical day: base flow at night, peak by day.
See it: a leak and more users give different shapes

Rise at night hours
Rise at day hours
Daily volume

The dotted line is the typical day of the borehole for days 0 to 34 (Application 1). The solid line is a typical day after a change: a constant leak added to every hour, a growth that multiplies every hour, or both; or the measured days 35 to 59. The bars are the difference at each hour. Both causes can raise the daily volume by the same 22 m³; only the shape of the bars tells them apart.

Watch it build: three parts
day 07142127 28 days of a building, kWh days 7 to 13: trend 559.6 days 0, 1, 2: no trend trend + weekly pattern left over: the remainder
  1. The first 28 days of the building's daily energy. Each weekend (shaded) falls by about 180 kWh.
  2. Each 7 day window holds one of every weekday: days 7 to 13 average 559.6 kWh, the trend for day 10.
  3. Days 0, 1 and 2 have no 3 days before them, so the centred trend starts on day 3.
  4. The weekly pattern adds +41 to +65 kWh on weekdays and takes −125 and −130 at the weekend.
  5. The remainder is what is left. Over the record its scatter is 56 kWh, against 159 kWh in the data.
daily energy= trend+ weekly pattern+ remainder Scatter: 159 kWh in the data, 56 kWh left over.

Check yourself

Three questions. Each wrong choice is a mistake people really make, so read the note after you answer.

1. Two months of a pumped supply are compared hour by hour. The night flow rose from 0.60 to 0.72 m³/h and the day flow from 4.5 to 5.4 m³/h. What is the most likely cause?

2. A dashboard draws a 7-day trailing average of daily energy (each day and the six before it). The average turns down on day 50. About when did the building's use really turn?

3. The building of Application 2 uses 609.9 kWh on a weekday and 431.9 kWh on a weekend day, in both months. Month A has 23 weekdays and 8 weekend days; month B has 20 weekdays and 10 weekend days. The mean of all days falls from 564.0 to 550.6 kWh. What do you report?

Found this useful?

Discussion

    Comments show your name. Be kind, stay on the topic.