Combining independent uncertainties
For a sum or a difference,
For a product or a quotient,
A contractor reports a saving of 11.46 percent and asks to be paid on it. The owner’s accountant asks one question: could the real figure be 9 percent, or 14? Nobody in the room can answer, so the meeting becomes an argument about trust in place of a discussion of numbers. A saving is the difference between a measured quantity and an estimate of what would have happened, and every estimate has a range. This lesson shows where the range comes from, how to calculate it for a baseline model and for a measured power with agreed hours, and how to say when a saving is too uncertain to report. #SavingsUncertainty #MeasurementAndVerification #EnergySavings
By the end of this lesson, you will be able to:
The site of this course has a baseline model fitted to one year of daily energy readings. A measure was installed on day 500. Over days 500 to 729 the adjusted baseline is 120,871 kWh, the utility meter recorded 107,014 kWh, and the avoided energy is 13,857 kWh, which is 11.46 percent.
Only one of those three numbers was read from an instrument. The adjusted baseline is the output of a model that was wrong by about 27 kWh on a typical day of its own baseline year, so the avoided energy carries the model’s error.
This data set was generated for the course, so the true saving is known: 12 percent. On a real site nobody knows the true value. The report can give a range, and an honest statement of how it was calculated.
Every quantity in a savings calculation is one of four kinds, and each kind brings its own uncertainty.
| Source | What it is | Example |
|---|---|---|
| Measurement | The instrument does not read the true value | A power meter accurate to 2 percent of reading |
| Model | The baseline model does not reproduce each day | RMSE of 27.30 kWh a day |
| Sampling | Some items were measured and the rest assumed equal | 12 fittings measured of 120 |
| Estimates | A value was agreed and never measured | Operating hours agreed as 4,200 a year |
An uncertainty of this kind is a statement about random error. It does not cover a mistake, such as a wrong meter multiplier or a change on the site that nobody reported. Those are found by checking, not by statistics.
The standard uncertainty
Combining independent uncertainties
For a sum or a difference,
For a product or a quotient,
Because the terms are squared, the largest one decides the result.
The expanded uncertainty is
The root mean square error (RMSE) of the baseline model is its typical error on one day. Over the
Simple uncertainty of avoided energy
The saving grows in proportion to
The simple form assumes two things that are not fully true. It treats the model’s coefficients as exact, and it treats the daily errors as independent.
The coefficients were fitted to a limited set of noisy days, so they have errors of their own. An intercept 2 kWh too low is 2 kWh too low on every day of the reporting period, and this error does not cancel when days are added.
Ordinary regression theory gives the variance of a sum of predictions. Let
Uncertainty of the sum with coefficient uncertainty
The
For the simplest model, a constant mean fitted to
On a real site a high day is often followed by another high day. The errors then cancel less, and both forms above are too narrow. A common correction replaces the number of days by a smaller, effective number of independent days. With the lag-1 autocorrelation
ASHRAE Guideline 14 states the uncertainty of a saving from a baseline model as the fractional savings uncertainty (FSU): the uncertainty as a share of the saving. Its widely used approximate form, from Reddy and Claridge, is
Here
For this site (
A commonly used criterion is that the saving should be at least about twice its standard uncertainty to be reported with confidence: saving
Standard uncertainty.
✅
Expanded uncertainty.
The saving with its range.
✅
Relative precision.
✅
As a percentage saving. Divide the ends of the range by the adjusted baseline:
Standard uncertainty.
The coefficient part alone is
Expanded uncertainty and range.
Relative precision.
Check the size of q by hand. For a model that is only a mean,
Against the true value. The estimate is 722 kWh below the true 14,579 kWh. That is 1.7 times the simple standard uncertainty and 1.3 times the fuller one. The true value lies inside both ranges, close to the edge of the simple one. ✅
The method. The generator is run with 2,000 different seeds. Each run is a new site with the same physics and new weather and new random scatter. For each run the baseline is fitted to the first 365 days and the avoided energy is calculated for days 500 to 729, exactly as before. The true saving of each run is 12 percent of the energy the generator gives before the measure, without the random part. ✅
The spread of the result. The mean estimate is 14,524 kWh against a mean true saving of 14,543 kWh, so the method has almost no bias. The standard deviation of the estimated saving is 538 kWh, and of the error (estimate minus true) 534 kWh. ✅
Compare with the two forms. Over the 2,000 runs the simple form gives a mean
Coverage. The range of the estimate
A stricter definition of the truth. If the random part of each day is counted as energy the site would really have used, the error has a standard deviation of 572 kWh, and the coverage is 86.2 percent (simple) and 95.3 percent (fuller). The fuller form holds under both definitions. ✅
The check you can make on a real site. No real site can be run 2,000 times, but every site has days before the measure that the model did not see. Apply the whole method to days 365 to 499, where the true saving is zero. The “saving” is
The criterion. The saving is
Length of the reporting period, simple form. Take the mean of this period: an adjusted baseline of 525.5 kWh a day and a saving of 60.25 kWh a day. The relative precision is
| Reporting days | Saving found, 11.46 percent | A saving of 3 percent | |
|---|---|---|---|
| 30 | 299 | 16.5 percent | 63.2 percent |
| 90 | 518 | 9.6 percent | 36.5 percent |
| 230 | 828 | 6.0 percent | 22.8 percent |
| 365 | 1,043 | 4.7 percent | 18.1 percent |
Four times as many days halve the relative precision. ✅
A saving of 3 percent. It is 15.77 kWh a day. It passes the criterion of twice its standard uncertainty after 12 days by the simple form. After 230 days it is 3,626 kWh, known to 22.8 percent by the simple form and to 30.0 percent by the fuller form. It can be reported, and the report must say “3 percent, between about 2 and 4”. ✅
The floor. The coefficient part alone, 353 kWh over 230 days, is 5.1 percent of the saving found at
Check with the script. The script prints 414 and 544 kWh, 828 and 1,089 kWh, 6.0 and 7.9 percent, the table above, and the simulation figures. All agree with the hand values. ✅
power ## 3.8 % hours ######################################## 96.2 %The saving.
At the example price this is 217,728 currency units a year. ✅
Combined relative standard uncertainty. The saving is a product, so the relative uncertainties combine. The count has none.
✅
In kWh.
The range.
In money: 217,728 plus or minus 44,408, which is 173,320 to 262,136 currency units a year. The relative precision is 20.4 percent. ✅
Share of the variance. Power:
A better power meter. With the power known to 1 percent:
Logged hours. With an hours counter or a logger on the lighting circuit, the hours are known to about 2 percent:
Check a second way. The script draws 200,000 random pairs of power and hours with these uncertainties and calculates the saving for each. The standard deviation is 1,845 kWh, against 1,850 kWh from the root sum of squares. ✅
The script calculates both forms of the uncertainty for the site, repeats the whole analysis for 2,000 simulated sites, gives the relative precision against the length of the reporting period, and works project D. It saves one plot: the error of the estimated saving over the 2,000 runs, with the two forms drawn over it.
"""How sure is the saving? Baseline model uncertainty, a simulation check, and Option A."""import numpy as npimport matplotlib.pyplot as plt
PRICE = 12.00 # currency units per kWh
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 cdd = np.clip(temp - 18.0, 0.0, None) energy = 310.0 + 42.0 * cdd + np.where(weekday, 180.0, 0.0) + rng.normal(0, 28.0, days) energy[500:] *= 0.88 return d, temp, weekday, energy # kWh a day
def avoided_energy(seed): """Fit days 0 to 364, report days 500 to 729. Returns the pieces of the result.""" d, temp, weekday, energy = building_daily(seed) cdd = np.clip(temp - 18.0, 0.0, None) X = np.column_stack([np.ones(d.size), cdd, weekday.astype(float)]) Xb, yb, Xr, yr = X[:365], energy[:365], X[500:], energy[500:] coef, *_ = np.linalg.lstsq(Xb, yb, rcond=None) rmse = np.sqrt(np.sum((yb - Xb @ coef) ** 2) / (365 - 3)) m = yr.size s = Xr.sum(axis=0) # column sums of the reporting period q = s @ np.linalg.solve(Xb.T @ Xb, s) # 1' Xr (Xb'Xb)^-1 Xr' 1 saving = (Xr @ coef).sum() - yr.sum() noiseless = Xr @ np.array([310.0, 42.0, 180.0]) # unsaved energy without noise return dict(coef=coef, rmse=rmse, m=m, q=q, base=(Xr @ coef).sum(), meas=yr.sum(), saving=saving, u_simple=rmse * np.sqrt(m), u_full=rmse * np.sqrt(m + q), true=0.12 * noiseless.sum(), true_noisy=0.12 * yr.sum() / 0.88, sums=s, mean_base=yb.mean())
# ---------- Part 1: the site of this course ----------r = avoided_energy(23)S, base = r["saving"], r["base"]print("Baseline on days 0 to 364, reporting period days 500 to 729")print(f" RMSE {r['rmse']:.2f} kWh, CV(RMSE) {100 * r['rmse'] / r['mean_base']:.2f} %, m = {r['m']} days")print(f" adjusted baseline {base:.0f}, measured {r['meas']:.0f}, " f"avoided {S:.0f} kWh = {100 * S / base:.2f} %")for name, u in (("simple", r["u_simple"]), ("fuller", r["u_full"])): U = 2 * u print(f" {name}: u = {u:.0f} kWh, U = {U:.0f} kWh, range {S - U:.0f} to {S + U:.0f} kWh " f"= {100 * (S - U) / base:.1f} to {100 * (S + U) / base:.1f} %, " f"relative precision {100 * U / S:.1f} %, saving / u = {S / u:.1f}")print(f" column sums of the reporting period: {r['sums'][0]:.0f} days, " f"{r['sums'][1]:.1f} degree days, {r['sums'][2]:.0f} weekdays")print(f" coefficient term: q = {r['q']:.1f} against m = {r['m']}, " f"u of that part alone {r['rmse'] * np.sqrt(r['q']):.0f} kWh")print(f" mean-only model for comparison: q = m^2/n = {r['m'] ** 2 / 365:.1f}, " f"u = {r['rmse'] * np.sqrt(r['m'] + r['m'] ** 2 / 365):.0f} kWh")print(f" true saving of this data set: {r['true']:.0f} kWh without the daily noise " f"(estimate {S - r['true']:+.0f}), {r['true_noisy']:.0f} kWh with it " f"(estimate {S - r['true_noisy']:+.0f})")
# ---------- Part 2: simulation with 2,000 seeds ----------runs = [avoided_energy(seed) for seed in range(2000)]est = np.array([x["saving"] for x in runs])tru = np.array([x["true"] for x in runs])us = np.array([x["u_simple"] for x in runs])uf = np.array([x["u_full"] for x in runs])err = est - truprint("Simulation, 2000 data sets from the same generator")print(f" mean estimated saving {est.mean():.0f} kWh, mean true saving {tru.mean():.0f} kWh")print(f" standard deviation of the estimated saving {est.std(ddof=1):.0f} kWh")print(f" standard deviation of (estimate - true) {err.std(ddof=1):.0f} kWh, mean {err.mean():+.0f} kWh")print(f" mean u: simple {us.mean():.0f} kWh, fuller {uf.mean():.0f} kWh")print(f" true saving inside estimate +/- 2u: simple {100 * np.mean(np.abs(err) <= 2 * us):.1f} %, " f"fuller {100 * np.mean(np.abs(err) <= 2 * uf):.1f} %")err2 = est - np.array([x["true_noisy"] for x in runs])print(f" with the daily noise counted in the true saving: standard deviation {err2.std(ddof=1):.0f} kWh, " f"inside: simple {100 * np.mean(np.abs(err2) <= 2 * us):.1f} %, " f"fuller {100 * np.mean(np.abs(err2) <= 2 * uf):.1f} %")
# ---------- Part 3: length of the reporting period and size of the saving ----------day_base = base / r["m"] # mean adjusted baseline, kWh a dayprint(f"Relative precision by the simple form, baseline {day_base:.1f} kWh a day")print(" U = 2 x RMSE x sqrt(m): " + ", ".join( f"{m} d: {2 * r['rmse'] * np.sqrt(m):.0f} kWh" for m in (30, 90, 230, 365)))for label, per_day in (("saving found", S / r["m"]), ("3 percent saving", 0.03 * day_base)): row = ", ".join(f"{m} d: {100 * 2 * r['rmse'] * np.sqrt(m) / (per_day * m):.1f} %" for m in (30, 90, 230, 365)) print(f" {label} ({per_day:.2f} kWh a day): {row}") print(f" days until saving = 2u: {(2 * r['rmse'] / per_day) ** 2:.1f}")s3 = 0.03 * baseprint(f" 3 percent over 230 days: {s3:.0f} kWh, fuller relative precision " f"{100 * 2 * r['u_full'] / s3:.1f} %, saving / u = {s3 / r['u_full']:.1f}")print(f" floor set by the coefficients: {100 * 2 * r['rmse'] * np.sqrt(r['q']) / S:.1f} % " f"of the saving found, {100 * 2 * r['rmse'] * np.sqrt(r['q']) / s3:.1f} % of a 3 percent saving")
# ---------- Part 4: project D by Option A ----------N, DP, H = 120, 36.0, 4200.0 # fittings, W each, hours a yearU_P, U_H = 0.02, 0.10 # relative standard uncertaintiessav = N * DP * H / 1000.0u_rel = np.hypot(U_P, U_H)u = u_rel * savprint("Project D by Option A")print(f" saving {sav:.0f} kWh a year = {sav * PRICE:.0f} currency units")print(f" combined relative standard uncertainty {100 * u_rel:.2f} %, u = {u:.0f} kWh, U = {2 * u:.0f} kWh")print(f" range {sav - 2 * u:.0f} to {sav + 2 * u:.0f} kWh, " f"{(sav - 2 * u) * PRICE:.0f} to {(sav + 2 * u) * PRICE:.0f} currency units " f"(U = {2 * u * PRICE:.0f})")print(f" share of the variance: power {100 * U_P ** 2 / u_rel ** 2:.1f} %, " f"hours {100 * U_H ** 2 / u_rel ** 2:.1f} %")for name, a, b in (("power to 1 %", 0.01, U_H), ("hours logged to 2 %", U_P, 0.02)): ur = np.hypot(a, b) print(f" {name}: {100 * ur:.2f} %, U = {2 * ur * sav:.0f} kWh = {2 * ur * sav * PRICE:.0f} currency units")lo, hi = N * DP * (1 - U_P) * H * (1 - U_H) / 1000, N * DP * (1 + U_P) * H * (1 + U_H) / 1000print(f" both one standard uncertainty low or high: {lo:.0f} to {hi:.0f} kWh " f"(root sum of squares gives {sav - u:.0f} to {sav + u:.0f})")rng = np.random.default_rng(1)mc = N * DP * (1 + rng.normal(0, U_P, 200_000)) * H * (1 + rng.normal(0, U_H, 200_000)) / 1000print(f" random trial of 200000 cases: standard deviation {mc.std():.0f} kWh")
# ---------- Plot ----------fig, ax = plt.subplots(figsize=(8, 5))ax.hist(err, bins=50, density=True, alpha=0.6, label="2,000 simulated sites")x = np.linspace(err.min(), err.max(), 300)for name, u_ in (("simple", us.mean()), ("fuller", uf.mean())): ax.plot(x, np.exp(-0.5 * (x / u_) ** 2) / (u_ * np.sqrt(2 * np.pi)), label=f"{name}, u = {u_:.0f} kWh")ax.set_xlabel("estimated saving minus true saving, kWh")ax.set_ylabel("density")ax.set_title("Error of the avoided energy over 230 days")ax.legend()fig.tight_layout()fig.savefig("savings_uncertainty.png", dpi=120)print("Saved savings_uncertainty.png")Expected output
Baseline on days 0 to 364, reporting period days 500 to 729 RMSE 27.30 kWh, CV(RMSE) 4.74 %, m = 230 days adjusted baseline 120871, measured 107014, avoided 13857 kWh = 11.46 % simple: u = 414 kWh, U = 828 kWh, range 13029 to 14685 kWh = 10.8 to 12.1 %, relative precision 6.0 %, saving / u = 33.5 fuller: u = 544 kWh, U = 1089 kWh, range 12768 to 14946 kWh = 10.6 to 12.4 %, relative precision 7.9 %, saving / u = 25.5 column sums of the reporting period: 230 days, 492.2 degree days, 164 weekdays coefficient term: q = 167.6 against m = 230, u of that part alone 353 kWh mean-only model for comparison: q = m^2/n = 144.9, u = 529 kWh true saving of this data set: 14579 kWh without the daily noise (estimate -722), 14593 kWh with it (estimate -736)Simulation, 2000 data sets from the same generator mean estimated saving 14524 kWh, mean true saving 14543 kWh standard deviation of the estimated saving 538 kWh standard deviation of (estimate - true) 534 kWh, mean -19 kWh mean u: simple 424 kWh, fuller 560 kWh true saving inside estimate +/- 2u: simple 88.8 %, fuller 96.7 % with the daily noise counted in the true saving: standard deviation 572 kWh, inside: simple 86.2 %, fuller 95.3 %Relative precision by the simple form, baseline 525.5 kWh a day U = 2 x RMSE x sqrt(m): 30 d: 299 kWh, 90 d: 518 kWh, 230 d: 828 kWh, 365 d: 1043 kWh saving found (60.25 kWh a day): 30 d: 16.5 %, 90 d: 9.6 %, 230 d: 6.0 %, 365 d: 4.7 % days until saving = 2u: 0.8 3 percent saving (15.77 kWh a day): 30 d: 63.2 %, 90 d: 36.5 %, 230 d: 22.8 %, 365 d: 18.1 % days until saving = 2u: 12.0 3 percent over 230 days: 3626 kWh, fuller relative precision 30.0 %, saving / u = 6.7 floor set by the coefficients: 5.1 % of the saving found, 19.5 % of a 3 percent savingProject D by Option A saving 18144 kWh a year = 217728 currency units combined relative standard uncertainty 10.20 %, u = 1850 kWh, U = 3701 kWh range 14443 to 21845 kWh, 173320 to 262136 currency units (U = 44408) share of the variance: power 3.8 %, hours 96.2 % power to 1 %: 10.05 %, U = 3647 kWh = 43763 currency units hours logged to 2 %: 2.83 %, U = 1026 kWh = 12317 currency units both one standard uncertainty low or high: 16003 to 20358 kWh (root sum of squares gives 16294 to 19994) random trial of 200000 cases: standard deviation 1845 kWhSaved savings_uncertainty.pngIn the plot the curve of the fuller form follows the simulated errors, and the curve of the simple form is too narrow and too tall.
1. A motor is replaced. The power reduction is 0.70 kW, measured with a relative standard uncertainty of 3 percent. The hours are agreed as 5,000 a year with a relative standard uncertainty of 8 percent. Find the saving and its expanded uncertainty.
2. An old fitting is measured as 72 W and a new one as 36 W, with two different meters, each with a relative standard uncertainty of 2 percent of its reading. Find the standard uncertainty of the power reduction in watts and in percent. Why is it not 2 percent?
The uncertainties are
3. A baseline model has an RMSE of 40 kWh a day, and a measure is expected to save 25 kWh a day. By the simple form, after how many days does the saving equal twice its standard uncertainty? How many days are needed for a relative precision of 20 percent?
Saving
4. A baseline that is a constant mean was fitted to 365 days with an RMSE of 30 kWh. The reporting period is 180 days. Find the standard uncertainty of the summed baseline by the simple form and with the coefficient term
Simple:
After 90 days of the reporting period, a saving is known to within 9.6 percent of its value. The site and the saving stay the same. How well is the saving known after 360 days, four times as long?
The saving is the saving fraction × the mean baseline energy of a day × the number of days. The shaded band is ± U by the simple form, U = 2 × RMSE × √m, and the first six readouts use this form. The dashed band is the fuller form, U = 2 × RMSE × √(m + q). It is approximate here: q is taken as the lesson's 167.6 at 230 days and grows with the square of the days. That is true only when the reporting days have the same average weather and the same share of weekdays as the lesson's 230 days, against the lesson's baseline year. The lower plot is the relative precision of both forms. At 100 percent the saving equals twice its standard uncertainty, which is the commonly used criterion for reporting. Which case the numbers show: the first button is Application 1 below, with 13,857 kWh, 414 and 828 kWh and 6.0 percent, and 544 and 1,089 kWh and 7.9 percent by the fuller form. Both forms assume independent daily errors. On real data autocorrelation makes both ranges wider, and a contract should use the formula of the current ASHRAE Guideline 14.
Three questions. Each wrong choice is a mistake people really make, so read the note after you answer.
1. Over 230 days the adjusted baseline is 120,871 kWh and the avoided energy is 13,857 kWh. The expanded uncertainty of the baseline model is 828 kWh. What is the relative precision of the saving?
2. On the same site, with the same model and the same 230 days, another measure saves 3 percent: 3,626 kWh. What is the relative precision of this saving by the simple form?
3. For the 230 days, the scatter of the days gives a standard uncertainty of 414 kWh and the uncertainty of the coefficients gives 353 kWh. The two are independent. What is the standard uncertainty of the saving?
No comments yet. Questions, results from your own build, a better way to explain it: all welcome.
Kept on this device only. Nothing is sent anywhere.
Tip: select words in the lesson, or tap a figure or an equation, to put a note right there.
The lesson has changed and these words are no longer in it. Your notes are kept, with the words you chose.