This post defines the decision, the event, the probability of the event from a quantile forecaster and from a Laplace forecaster, and the two scores that measure its quality and its value, the Brier score and the relative economic value.
Series: Forecast Value, Part 1. Part 2 trains a quantile forecaster and a Laplace forecaster on a simulated transformer and scores them on the definitions below. Part 3 treats overloads that last for hours.
Value of a Forecast
An accuracy score says how far a forecast lies from what happened. It does not say what the forecast is worth to the person who acts on it. A distribution operator who must decide in the evening whether to warn a crew about tomorrow’s loading of a transformer gains from a forecast only through the decision, and the decision depends on what a warning costs and on what an unwarned overload costs.1 Two forecasts with the same error can therefore differ in value, and a forecast with a larger error can be worth more to one user than a more accurate one.
This series measures the value of two kinds of probabilistic forecast on one decision: a quantile forecaster, which returns a set of quantiles, and a parametric Laplace forecaster, which returns a location and a scale. The first part gives the definitions. It states the decision, defines the event that the decision is about, shows how each forecaster gives the probability of the event, and defines the two scores that follow, the Brier score for the quality of the probability and the relative economic value for its worth. The illustrations use simulated numbers and are labelled as such. The data and the trained forecasters come in Part 2.
Show the setup and the plotting helpers
import warningswarnings.filterwarnings("ignore")from importlib.metadata import versionimport refrom IPython.display import HTML, displayfrom lets_plot import ( aes, element_blank, element_line, element_rect, element_text, facet_wrap, geom_blank, geom_hline, geom_line, geom_point, geom_rect, geom_segment, geom_text, geom_tile, geom_vline, ggplot, ggsize, labs, scale_color_manual, scale_fill_manual, scale_size_manual, scale_linetype_manual, scale_y_discrete, scale_x_continuous, scale_y_continuous, theme,)import numpy as npimport pandas as pdfrom scipy import statsfrom twiga.core.metrics.decision import probability_scores, relative_economic_value_curvefrom twiga.core.metrics.events import event_probability, run_eventfrom twiga.distributions.scenarios import quantile_cdf# Colours by role: subject blue, highlight orange, reference slate, context grey.BLUE, ORANGE, SLATE, INK ="#0369A1", "#E26029", "#64748B", "#1E293B"ORANGE_INK ="#C4500F"# the orange of text, darkened to a contrast of 4.7 against whiteGREY, FONT ="#CED4DA", "'Libre Franklin', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"def tint(colour: str, amount: float=0.85) ->str:"""A colour mixed with white, for bands and fills.""" rgb = np.array([int(colour[i : i +2], 16) for i in (1, 3, 5)])return"#"+"".join(f"{int(v):02X}"for v in rgb + (255- rgb) * amount)def house() -> theme:"""Thin dark axes on the left and bottom, no grid, no legend, Libre Franklin type."""return theme( legend_position="none", plot_background=element_rect(fill="white", color="white"), panel_background=element_blank(), panel_border=element_blank(), panel_grid=element_blank(), strip_background=element_blank(), strip_text=element_text(face="bold", size=14, hjust=0), axis_line=element_line(size=0.5, color=INK), axis_ticks=element_line(size=0.5, color=INK), axis_ticks_length=4, text=element_text(family=FONT, size=13, color=INK), plot_margin=[8, 18, 4, 4], )PHONE_WIDTH =420LAYOUT = {"phone": False}def columns(desktop: int, phone: int=1) ->int:"""Panels in a row: ``desktop`` on a wide screen, ``phone`` in the narrow variant of a figure."""return phone if LAYOUT["phone"] else desktopdef size(width: int, height: int, panels: int=1, ncol: int=1, phone_ncol: int=1) -> ggsize:"""Canvas of a figure: as given on a wide screen, narrow with the panels re-stacked in the phone variant."""ifnot LAYOUT["phone"]:return ggsize(width, height) per_panel = (height -60) /-(-panels // ncol) ratio = (PHONE_WIDTH / phone_ncol) / (width / ncol)return ggsize(PHONE_WIDTH, int(60+-(-panels // phone_ncol) * per_panel * ratio *1.15))def inline(plot, kind: str) ->str:"""The SVG of a figure as a block that scales with the page; ``kind`` marks the wide or the narrow variant.""" svg = plot.to_svg() width, height = (float(v) for v in re.search(r'width="([\d.]+)" height="([\d.]+)"', svg).groups()) svg = svg.replace(f'width="{width}" height="{height}"', f'viewBox="0 0 {width:g}{height:g}" width="100%"', 1)returnf'<div class="letsplot letsplot-{kind}">{svg}</div>'def show(build) ->None:"""Draw a figure twice, wide and narrow, so that the page shows the variant that fits the width of the screen.""" LAYOUT["phone"] =False wide = inline(build(), "desktop") LAYOUT["phone"] =Truetry: narrow = inline(build(), "phone")finally: LAYOUT["phone"] =False display(HTML(wide + narrow))def note(frame: pd.DataFrame, colour: str= INK, hjust: float=0.0, size: float=5.6):"""Direct labels from a frame with columns x, y, label (and the facet column), with a white halo over the marks."""return geom_text( aes("x", "y", label="label"), data=frame, color=colour, hjust=hjust, size=size, family=FONT, halo_width=2, halo_color="white", inherit_aes=False, )generator = np.random.default_rng(2026)print("twiga", version("twiga"), "| lets-plot", version("lets-plot"))
Cost-Loss Decision
The simplest account of a warning is the cost-loss model.2 The user can protect against an event at a cost , whether or not the event happens. If the user does not protect and the event happens, the user suffers a loss with , and if the event does not happen there is no cost. A warning that precedes an event is a hit, a warning without an event is a false alarm, an event without a warning is a miss, and no warning without an event is a correct rejection, which costs nothing. The ratio of the two is the cost-loss ratio,
A user who believes that the event has probability expects to lose by not protecting and by protecting. Figure 1 draws the two expenses against in units of : protecting costs the constant , and not protecting costs . Protecting is cheaper when , which is the rule
The rule is the best one for a user whose probabilities are reliable, and it shows why the ratio belongs to the user and not to the forecast. A crew that can be redirected at little cost has a small ratio and warns on a weak signal, while an action that is expensive and disruptive has a large ratio and requires a strong one.
Show the code of the cost figure
ALPHA_EXAMPLE =0.25# an illustrative ratio: a loss four times the cost of actinggrid_p = np.linspace(0.0, 1.0, 201)actions = pd.DataFrame( {"p": np.r_[grid_p, grid_p],"expense": np.r_[np.full_like(grid_p, ALPHA_EXAMPLE), grid_p], # warn: always C; do not warn: pL, in units of L"action": ["Warn"] *len(grid_p) + ["Do not warn"] *len(grid_p), })bands = pd.DataFrame( {"xmin": [0.0, ALPHA_EXAMPLE], "xmax": [ALPHA_EXAMPLE, 1.0], "ymin": [0.0, 0.0], "ymax": [1.0, 1.0], "region": ["hold", "act"]})crossing = pd.DataFrame({"x": [ALPHA_EXAMPLE], "y": [ALPHA_EXAMPLE]})show(lambda: ggplot()+ geom_rect(aes(xmin="xmin", xmax="xmax", ymin="ymin", ymax="ymax", fill="region"), data=bands, color="rgba(0,0,0,0)", size=0)+ scale_fill_manual(values={"hold": tint(SLATE, 0.9), "act": tint(BLUE, 0.88)})+ geom_vline(xintercept=ALPHA_EXAMPLE, color=SLATE, linetype="dotted", size=0.6)+ geom_line(aes("p", "expense", color="action", size="action"), data=actions)+ scale_size_manual(values={"Warn": 1.5, "Do not warn": 0.8})+ scale_color_manual(values={"Warn": BLUE, "Do not warn": SLATE})+ geom_point(aes("x", "y"), data=crossing, shape=21, fill="white", color=INK, size=3.4, stroke=1.4)+ note(pd.DataFrame({"x": [ALPHA_EXAMPLE /2], "y": [0.94], "label": ["Do not warn"]}), SLATE, 0.5, 5.8)+ note(pd.DataFrame({"x": [(1+ ALPHA_EXAMPLE) /2], "y": [0.94], "label": ["Warn"]}), BLUE, 0.5, 5.8)+ note(pd.DataFrame({"x": [0.97], "y": [ALPHA_EXAMPLE +0.05], "label": ["Warning: cost C"]}), BLUE, 1.0, 5.6)+ note(pd.DataFrame({"x": [0.58], "y": [0.38], "label": ["No warning: pL"]}), SLATE, 0.0, 5.6)+ scale_x_continuous(name="Probability of the event, p", breaks=[0, ALPHA_EXAMPLE, 0.5, 0.75, 1.0], labels=["0", "\u03b1", "0.5", "0.75", "1"], limits=[0, 1], expand=[0, 0])+ scale_y_continuous(name="Expected expense, in units of L", breaks=[0, ALPHA_EXAMPLE, 0.5, 1.0], labels=["0", "\u03b1", "0.5", "1"], limits=[0, 1], expand=[0, 0])+ house()+ size(900, 420))
Figure 1: Expected expense of warning and of not warning against the probability of the event, in units of the loss L. The two actions cost the same where the probability equals the cost-loss ratio, marked by the circle.
Events as Runs
The decision turns on an event, and the event has to be defined before it can be forecast or scored. For a transformer, the quantity is the apparent power in kVA at each half-hour. The thermal limit is set relative to the network before electric vehicles and photovoltaic generation were added, as a multiple of the 98th percentile of the apparent power of that network, and it is called the pre-DER thermal limit,
The limit measures what the network carried before distributed energy resources, and it is not the nameplate rating. It is chosen because it is exceeded more often as penetration grows, which keeps the event informative; an event defined by the rating can be too rare to score. The decision considered here concerns loading that persists, so the event requires that the apparent power stays above the limit for consecutive half-hours, with for two hours. For a day of half-hours the outcome is
The outcome is one when some run of half-hours lies above the limit and zero otherwise. A value exactly at the limit is not above it, and a missing value ends a run.
Probability from Forecasts
A forecast gives the probability of the event when it gives a distribution for each half-hour. The two forecasters give it in different ways. A quantile forecaster returns the values at levels and no distribution between or beyond them.[^koenker1978] Its distribution function is completed by linear interpolation between neighbouring levels,
and, for , by an exponential tail beyond the outermost level, whose scale is fixed by the two outermost quantiles on that side,
The tail matters because a limit usually lies beyond the outermost level, where the quantiles are silent and a linear extension would fix the probability arbitrarily. A Laplace forecaster returns a location and a scale , and its distribution function is known in closed form. With the standardised distance it is
For one half-hour, the probability that the apparent power exceeds the limit is one minus the distribution function at the limit,
An event that lasts half-hours cannot be read from these marginal distributions, because it depends on how the half-hours move together. It is estimated instead from scenarios of the day, as the share of scenarios that contain the event,
Part 3 constructs the scenarios. The rest of this part uses events whose probability is given directly.
Figure 2: Distribution function of one simulated half-hour from each forecaster, with the quantiles of the first marked and the exceedance probability of the limit in orange.
Figure 2 applies both forecasters to one half-hour of a simulated transformer whose apparent power has a right tail. The true probability of exceeding the limit of 62 kVA is 0.069. The quantile forecaster gives 0.071, with its nine quantiles drawn as hollow points and the exponential tail carrying the curve beyond the last one. The Laplace forecaster gives 0.057, which is 18% below the true value. The Laplace distribution is symmetric about its median, so a right tail that is heavier than a Laplace tail is understated, and an operator who warned at a ratio of 0.06 would warn under the quantile forecaster and not under the Laplace forecaster. The two forecasters can therefore disagree about the same day, and the scores below decide which disagreement costs more.
Scoring a Probability
The quality of a probability of an event is measured by the Brier score, the mean squared difference between the forecast probability and the outcome over days,3
The score is strictly proper, so the best expected score is reached only by stating the true probability.4 It separates into a reliability term, which measures the gap between the stated probabilities and the frequencies with which the event followed them, a resolution term, which measures how far the frequencies of the forecast classes lie from the overall rate, and an uncertainty term that depends only on the event rate.5 A reliable forecast has a small reliability term, and a forecast that separates the days with the event from the days without has a large resolution term. For a probability estimated from scenarios, the fair estimator removes the sampling term of a small ensemble.6 The skill compares the score with that of a reference that states a constant rate taken from the training window,
A skill of one is a perfect forecast, zero is no better than the reference, and a negative value is worse. A constant rate is a weak reference where the risk depends on the hour of the day, and the later parts also use the rate for each hour.
Show the simulation of the forecasts
DAYS, TRAIN =6000, 3000risk = generator.beta(2.0, 6.0, DAYS) # the true event probability of each day, mean 0.25event = (generator.uniform(size=DAYS) < risk).astype(int)logit = np.log(risk / (1- risk))forecasts = {"Calibrated": risk,"Over-confident": 1/ (1+ np.exp(-2.2* logit)), # the same ranking of days, probabilities pushed to the extremes}reference_rate =float(event[:TRAIN].mean()) # the rate a forecaster could have seen before the test daystest =slice(TRAIN, DAYS)rows, curves_value = [], []for name, probability in forecasts.items(): scores = probability_scores(probability[test], event[test], reference_rate=reference_rate) ratios, value = relative_economic_value_curve(probability[test], event[test], reference_rate=reference_rate) rows.append({"forecast": name, **{k: round(v, 4) for k, v in scores.items() if k in ("brier_score", "brier_skill_score", "reliability", "resolution", "uncertainty")}, "best_value": round(float(np.nanmax(value)), 3), "at_ratio": round(float(ratios[np.nanargmax(value)]), 2)}) curves_value.append(pd.DataFrame({"ratio": ratios, "value": value, "forecast": name}))summary = pd.DataFrame(rows)curves_value = pd.concat(curves_value)print(f"reference rate {reference_rate:.3f}; test rate {event[test].mean():.3f}")print(summary.to_string(index=False))
A simulated example shows what the three parts measure. Over 6,000 days the true probability of the event follows a Beta distribution with mean 0.25, and the outcome of each day is drawn from it. Two forecasts are scored on the last 3,000 days, with the rate of the first 3,000 as the reference. The calibrated forecast states the true probability. The over-confident forecast ranks the days in the same order but pushes its probabilities towards zero and one. The event rate on the test days is 0.247.
The calibrated forecast has a Brier score of 0.1678 and a skill of 0.098. Its reliability term is 0.0002, so its probabilities match the frequencies, and its resolution term of 0.0173 is the information that it adds to the event rate. The over-confident forecast has a Brier score of 0.1840 and a skill of 0.011. Its resolution of 0.0154 is similar, so it separates the days almost as well, but its reliability of 0.0154 is far larger than the 0.0002 of the calibrated forecast. The whole of its loss lies in the stated probabilities and none in the ranking of the days. A user who acts on these probabilities, as the next section shows, bears that loss. The reliability and the resolution are computed in ten equal probability bins.
Relative Economic Value
The value of a probability forecast to a user is the expense saved by acting on it, set against what the user would spend without it. Let a warning be issued when the probability exceeds , and let be the days with a warning and an event, the days with a warning and no event, and the days with an event and no warning, among days. In units of the user who follows the forecast pays
Without a forecast the user either always protects or never protects. With the event frequency , the better of the two pays
and a user with perfect knowledge protects only on the days with an event and pays
The relative economic value is the share of the possible saving that the forecast achieves,7
It is one for a perfect forecast and zero for the better of always and never protecting, and it is negative where the forecast does worse than that. Consider 100 days with 20 events and a ratio of , so that a loss is six times the cost of acting. A forecast warns on 30 days, with 16 hits, 14 false alarms and 4 misses. Then , and , so that . The forecast achieves 58% of the saving that perfect knowledge would give this user.
Show the worked example
# The worked example of the text: 100 days, 20 events, 30 warnings of which 16 are hits, 14 false alarms, 4 misses.N_DAYS, hits, false_alarms, misses =100, 16, 14, 4events = hits + missess = events / N_DAYSexpense_forecast = (ALPHA_EXAMPLE * (hits + false_alarms) + misses) / N_DAYSexpense_climatology =min(ALPHA_EXAMPLE, s)expense_perfect = ALPHA_EXAMPLE * svalue = (expense_climatology - expense_forecast) / (expense_climatology - expense_perfect)hit_rate, false_alarm_rate = hits / events, false_alarms / (N_DAYS - events)form_book = (expense_climatology - false_alarm_rate * ALPHA_EXAMPLE * (1- s) - hit_rate * ALPHA_EXAMPLE * s - (1- hit_rate) * s) / (expense_climatology - ALPHA_EXAMPLE * s)print(f"E_fc {expense_forecast:.4f}, E_clim {expense_climatology:.4f}, E_perf {expense_perfect:.4f}, V {value:.4f}; hit-rate form {form_book:.4f}")exact =float(truth.sf(LIMIT))over = curves_value[curves_value["forecast"] =="Over-confident"].dropna()calibrated = curves_value[curves_value["forecast"] =="Calibrated"].dropna()print(f"exact exceedance {exact:.4f}, quantile {p_quantile:.4f}, laplace {p_laplace:.4f}")print("over-confident value first non-negative at ratio", float(over.loc[over["value"] >=0, "ratio"].iloc[0]))print("calibrated value above 0.05 up to ratio", float(calibrated.loc[calibrated["value"] >0.05, "ratio"].max()))print("over-confident value at ratios 0.1 and 0.15:", [round(float(over.loc[(over["ratio"] - r).abs().idxmin(), "value"]), 3) for r in (0.1, 0.15)])
Show the code of the value figure
best = curves_value.loc[curves_value.groupby("forecast")["value"].idxmax()]plotted = curves_value[curves_value["value"] >=-0.6] # clipped to the axis, so that no row is dropped by the scale; the text says where the curve continuesshow(lambda: ggplot(plotted, aes("ratio", "value", color="forecast"))+ geom_hline(yintercept=0.0, color=SLATE, linetype="dotted", size=0.8)+ geom_line(size=1.5)+ scale_color_manual(values={"Calibrated": BLUE, "Over-confident": ORANGE})+ geom_point(data=best, shape=21, fill="white", size=3.6, stroke=1.5)+ note(pd.DataFrame({"x": [0.29], "y": [0.35], "label": ["Calibrated"]}), BLUE, 0.0, 6.0)+ note(pd.DataFrame({"x": [0.12], "y": [-0.42], "label": ["Over-confident"]}), ORANGE_INK, 0.0, 6.0)+ note(pd.DataFrame({"x": [0.02], "y": [-0.57], "label": ["Continues to \u22121.75 at 0.01"]}), ORANGE_INK, 0.0, 5.0)+ note(pd.DataFrame({"x": [0.99], "y": [-0.1], "label": ["Climatology: no value"]}), SLATE, 1.0, 5.4)+ scale_x_continuous(name="Cost-loss ratio", limits=[0, 1], breaks=[0, 0.2, 0.4, 0.6, 0.8, 1.0])+ scale_y_continuous(name="Relative economic value", limits=[-0.6, 0.6], breaks=[-0.5, 0, 0.5])+ house()+ size(900, 400))
Figure 3: Relative economic value of two simulated forecasts against the cost-loss ratio. Blue is the calibrated forecast and orange the over-confident one, and circles mark the maxima.
Figure 3 gives the value of the two simulated forecasts for every ratio. The calibrated forecast has a value of at least 0.05 for ratios up to 0.47, with a maximum of 0.288 at a ratio of 0.25. The maximum lies near the event rate of 0.247. For ratios above 0.5 the value is close to zero. The over-confident forecast has a maximum of 0.224 at the same ratio, which is 22% lower, and it has a negative value for every ratio below 0.19, falling to at a ratio of 0.10. A user for whom acting costs little would have done better by ignoring the forecast and following the better of always or never protecting.
The Brier score and the value therefore agree on the ranking here and disagree on how much it matters. The skill of the over-confident forecast, 0.011, says that it is about as good as the constant rate, and the value curve says for whom it is worse. The users who lose most are those with the smallest cost-loss ratios. A forecast is judged by the users that it is meant to serve, and the two forecasters of Part 2 are compared on that curve.
Limits of the Illustration
The numbers of this part are simulated. The probabilities, the outcomes and the apparent power of Figure 2 are drawn from stated distributions to show what the scores measure, and they are not results for a transformer. The value curve describes a family of users and not a single number, because the value of a forecast depends on the cost-loss ratio of the user, so Part 2 reports the whole curve and the ratios at which a forecaster is best. The skill is measured against a constant rate, which is a weak reference for a risk that depends on the hour of the day, and a skill against that reference can look larger than a skill against the rate for each hour. Finally, the days are treated as independent, whereas the probabilities of consecutive days are correlated, which widens the uncertainty of every score in this series beyond what the number of days suggests.
Next Steps
Part 2 takes a simulated transformer with a high penetration of electric vehicles and photovoltaic generation, defines the headroom limit from its pre-DER record, trains a quantile forecaster and a Laplace forecaster, and scores the probability of the single-step event with the Brier score and the value curve defined here. Part 3 constructs scenarios for the event that lasts two hours, shows how much a forecast that treats the half-hours as independent underestimates it, and measures what the dependence adds to the value.
Reproducible Results
The notebook computes every figure of this part from a seeded generator and the functions of twiga that score events and their value, twiga.core.metrics.events and twiga.core.metrics.decision. The event functions are in the main branch of twiga and are not yet in a release, so a release of twiga that contains them is needed to reproduce the notebook from the package index.
References
[1] A. H. Murphy, “What is a good forecast? An essay on the nature of goodness in weather forecasting,” Weather Forecast., vol. 8, no. 2, pp. 281-293, 1993.↩︎
[2] A. H. Murphy, “The value of climatological, categorical and probabilistic forecasts in the cost-loss ratio situation,” Mon. Weather Rev., vol. 105, no. 7, pp. 803-816, 1977.↩︎
[3] G. W. Brier, “Verification of forecasts expressed in terms of probability,” Mon. Weather Rev., vol. 78, no. 1, pp. 1-3, 1950.↩︎
[4] T. Gneiting and A. E. Raftery, “Strictly proper scoring rules, prediction, and estimation,” J. Amer. Statist. Assoc., vol. 102, no. 477, pp. 359-378, 2007.↩︎
[5] A. H. Murphy, “A new vector partition of the probability score,” J. Appl. Meteor., vol. 12, no. 4, pp. 595-600, 1973.↩︎
[6] C. A. T. Ferro, “Fair scores for ensemble forecasts,” Q. J. R. Meteorol. Soc., vol. 140, no. 683, pp. 1917-1923, 2014.↩︎
[7] D. S. Richardson, “Skill and relative economic value of the ECMWF ensemble prediction system,” Q. J. R. Meteorol. Soc., vol. 126, no. 563, pp. 649-667, 2000.↩︎
Citation
BibTeX citation:
@online{faustine2026,
author = {Faustine, Anthony},
title = {Forecast {Value,} {Part} 1: {Events} and {Their} {Value}},
date = {2026-11-24},
url = {https://sambaiga.github.io/pages/blog/posts/2026/11/2026-11-24-forecast-value-events.html},
langid = {en}
}