mario.Database.calc_linkages
For IOT, let \(w=(I-z)^{-1}\) and \(g=(I-b)^{-1}\). The four linkage measures are:
DB / TB are direct / total backward linkages; DF / TF
are direct / total forward linkages. The tilde means that diagonal entries
are excluded when cut_diag=True. SUT uses the corresponding unified
activity/commodity systems.
With multi_mode=False and normalized=True, each measure is divided
by its mean:
Amplifications use the raw values: \(\mathrm{TB}/\mathrm{DB}\) and
\(\mathrm{TF}/\mathrm{DF}\). With multi_mode=True, each sum is split
into Local and Foreign contributors; each share is its component divided by
their sum. Normalization is not applied in that mode. Zero denominators in
amplifications and regional shares give NaN.
db.calc_linkages(...) returns the standard backward and forward linkages.
When multi_mode=False, the dataframe also includes Forward Amplification
and Backward Amplification ratios, defined as Total / Direct on the raw
linkage values.
When multi_mode=True, the dataframe keeps the Local and Foreign
components and adds their Local Share and Foreign Share for each
linkage measure.
Sparse flow blocks use sparse coefficient systems and actual production nodes, including unequal regional Activity/Commodity classifications. Regional totals are obtained by solving against regional indicator vectors, without requesting full Leontief or Ghosh inverse views. The result keeps the existing index, columns, normalization and amplification/share definitions.
cut_diag=True excludes self effects exactly. Sparse arrays are not modified
in place: direct diagonal terms are subtracted from the sums, and inverse
diagonal terms use selected inversion when suitable sparse factors are
available, or streamed unit-vector solves otherwise. Acyclic single-node
components have a direct diagonal formula. Exact diagonal extraction can still
be expensive for large strongly connected systems. The selected-inversion
recursion follows Jacquelin, Lin and Yang (2017).
Detected singular production components raise WrongInput before an inverse
is requested. The error identifies the system and its component nodes. MARIO
does not remove those nodes, change source values or replace the diagnosed
singular system with a pseudoinverse. This also applies when cut_diag=False:
including self effects does not restore invertibility.
- Database.calc_linkages(
- scenario='baseline',
- normalized=True,
- cut_diag=True,
- multi_mode=True,
Calculate backward and forward linkages for one scenario.
- Parameters:
scenario – Scenario to analyse.
normalized – When
True, normalize linkage indicators using the standard linkages convention.cut_diag – When
True, exclude diagonal terms exactly, without changing source matrices. Sparse inputs do not require a full inverse view.multi_mode – When
True, preserve the multi-regional interpretation of the linkages. This is valid only for multi-regional databases.
- Returns:
Linkages payload returned by
linkages_calculation(...).When
multi_mode=False, the returned dataframe contains total and direct backward/forward linkages plusForward AmplificationandBackward Amplificationratios computed asTotal / Directon the raw, non-normalized values.When
multi_mode=True, the returned dataframe keeps theLocalandForeigncomponents for each linkage measure and addsLocal ShareandForeign Sharecolumns for the same measures.- Return type:
object
- Raises:
WrongInput – When a singular production component is detected, identifying its nodes, or a linear solve fails its residual accuracy check.