mario.calc_S(s, Xc=None, *, Xa=None, tech_assumption=None)#

Calculate the SUT supply flows matrix S under IT or PT.

\[\begin{split}S = \begin{cases} s\operatorname{diag}(X_c) & \text{IT},\\ \left(c\operatorname{diag}(X_a)\right)^{\mathsf{T}}, \quad c=s^{-1} & \text{PT}. \end{cases}\end{split}\]
Parameters:
  • s (pandas.DataFrame) – Supply coefficients, with activity rows and commodity columns.

  • Xc (pandas.DataFrame or pandas.Series, optional) – Commodity production, required under IT and unused under PT. Its index must match the columns of s. A DataFrame must have one column.

  • Xa (pandas.DataFrame or pandas.Series, optional) – Activity production, required under PT and unused under IT. Its index must match the rows of s. A DataFrame must have one column.

  • tech_assumption ({"industry-based", "product-based", "IT", "PT"}, optional) – Technology assumption; defaults to industry-based (IT).

Returns:

Supply flows, with the activity rows and commodity columns of s.

Return type:

pandas.DataFrame

Notes

IT supports rectangular supply tables. PT requires square s and Xa; a missing Xa raises ValueError. The PT matrix inverse falls back to the Moore-Penrose pseudo-inverse for singular s.

Examples

import mario

S_it = mario.calc_S(s_it, Xc)
S_pt = mario.calc_S(s_pt, Xa=Xa, tech_assumption="PT")