How this calculation works
Minimum-trace forecast reconciliation adjusts an already-produced collection of forecasts to respect aggregation identities. A summing matrix specifies coherence, while a supplied error covariance determines the weighted projection. This task uses forecasts from an external model; it does not fit time-series dynamics or guarantee improved future accuracy.
G=(SᵀW⁻¹S)⁻¹SᵀW⁻¹; P=SG; reconciled y=P base_y; reconciled covariance=PWPᵀ.A worked example
For a parent forecast100and children70and50, with identity error covariance, MinTreturns(106⅔,63⅓,43⅓). The parent now equals the child sum. The adjustment vector is(6⅔,−6⅔,−6⅔), with Euclidean norm approximately11.5470054.
Good to know
2–20 total series,1–10 bottom series, a full-column-rank summing matrix S, matching base forecast vector and symmetric positive-definite covariance W with bounded condition number. Return reconciled forecasts, projection matrix and reconciled covariance; identity/diagonal W are same-page choices. No forecast-model fitting, automatic covariance estimation, nonnegativity constraint or guarantee of improved realized accuracy.
Forecast coherence is an aggregation constraint
A forecast hierarchy can contain a total and several component series. Independently fitted forecasts need not add up, even when the observed quantities satisfy an exact accounting identity. Reconciliation adjusts the forecast vector so it lies in the aggregation-consistent subspace. This differs from fitting a new forecasting model from historical observations or merely displaying the discrepancy.
The hierarchy or grouping is represented by a summing matrix S. Its columns correspond to bottom-level series, and its rows describe how every reported series aggregates them. Row order must match the base forecast vector and the supplied error covariance. A mislabeled row can produce internally coherent numbers for the wrong hierarchy, so names and ordering matter.
Compare this with the Vector autoregression calculator for multiple time series. Reconcile already-produced forecasts so totals and component series agree, minimizing trace under a supplied forecast-error covariance. VAR predicts several time series from lagged observations; it does not impose an aggregation hierarchy or reconcile inconsistent forecasts.
Supply the covariance that defines the weighting
The positive-definite matrix Wdescribes covariance of errors in the base forecasts at the relevant horizon. Diagonal entries give relative error variances and off-diagonal entries represent correlated errors. The calculator treats this matrix as supplied information. It does not estimate it from one forecast vector or infer reliable correlations from the aggregation structure alone.
Identity covariance gives an ordinary Euclidean projection and is useful for checking simple examples. A diagonal covariance expresses a particular independence approximation; a full covariance expresses additional dependence information. All are choices within the same reconciliation task. Near-singular or incompatible matrices are rejected because unstable inversions can magnify numerical error and distort the adjustment.
Calculate the weighted projection
The bottom-level reconciled vector solves a weighted least-squares problem comparing Sbtothe base forecasts, with precision W⁻¹. Full column rank of Sensures a unique solution under positive-definite W. Multiplying the fitted bottom vector by Sreturns coherent forecasts for every level. No observation history is required once the base vector and weighting matrix are available.
The resulting projection matrix Pmust satisfy PS=S: already-coherent forecasts remain unchanged. It is also idempotent, so reconciling an already-reconciled vector should make no further adjustment. These are weighted-projection properties, not an assertion that Phas ordinary symmetry for every W. Confusing weighted and ordinary geometry can lead to an incorrect implementation.
Derive the parent-and-two-children example
The example summing matrix has rows(1,1),(1,0),(0,1), describing a total and its two children. The base forecasts are100,70and50. Their discrepancy is twenty because the children sum to120. With Wset to the identity, the least-squares solution shares the required adjustment across all three reported series rather than discarding one level.
The reconciled parent is106⅔, while the children become63⅓and43⅓. Their sum is exactly106⅔. Each adjustment has magnitude6⅔, giving squared Euclidean adjustment norm400/3and norm approximately11.5470054. Rounding the displayed forecasts independently can obscure exact addition, so retain adequate precision when exporting the reconciled vector.
Interpret the covariance output conditionally
Under the assumed base-error covariance, multiplying Wby the projection on both sides gives the reconciled error covariance. This matrix is symmetric positive semidefinite, though it may be singular because aggregation identities reduce the number of independent directions. Singularity after coherent projection is expected and should not be mistaken for invalid input covariance.
The minimum-trace interpretation concerns the stated covariance model and linear unbiased reconciliation framework. It is not a guarantee that a particular future forecast error will shrink. A poorly estimated covariance or biased base forecasts can affect practical performance. Reconciliation also does not automatically constrain every forecast to be nonnegative, even for quantities that are physically nonnegative.
Check the solution independently
Construct a bottom-level vector b, form its coherent full vector Sband use that vector as the input forecast. The reconciled output should agree with it. Numerically verify P²=P, PS=Sand symmetry of PWPᵀ. The residual between the reported reconciled vector and S times its reported bottom-level representation should be close to zero.
Compare the formula with an independent constrained weighted least-squares solve for a small example. Multiplying Wby one positive scalar should not change the reconciled forecasts because it scales the whole objective uniformly. Reorder all series consistently to test label invariance, and deliberately mismatch dimensions or covariance symmetry to verify meaningful input rejection.
Keep modeling and accounting decisions visible
A vector autoregression, exponential-smoothing model or other external procedure can provide the base forecasts. Reconciliation then imposes the separately declared aggregation structure. Choosing which series should add up is a substantive accounting decision: forecasts for overlapping groups require the correct summing relationships rather than an invented tree that hides duplicated components.
Report S,series order, the forecast horizon and the source of Wwith the reconciled results. If nonnegativity or other inequality constraints are essential, they define an additional constrained reconciliation problem and should not be silently imposed by clipping the answer afterward. Clipping individual values can destroy the very aggregation identities this calculation was designed to preserve.
A few questions, answered
Does this fit forecasts from past observations?
No. It reconciles an existing forecast vector using a supplied summing matrix and covariance. Forecast-model fitting is a separate task.
Will the reconciled values always be nonnegative?
No. Unconstrained MinTis a linear projection. Nonnegative reconciliation requires additional constraints and must not be approximated by independent clipping.
Why can reconciled covariance be singular?
Exact aggregation relationships reduce the number of independent directions. A positive-semidefinite singular reconciled covariance can therefore be expected.
Does identity covariance mean all errors are known equal?
It is an explicit simplifying weighting assumption, useful for examples. It does not establish the actual error covariance from the supplied forecasts.