this post was submitted on 29 Mar 2025
5 points (100.0% liked)

chapotraphouse

13766 readers
703 users here now

Banned? DM Wmill to appeal.

No anti-nautilism posts. See: Eco-fascism Primer

Slop posts go in c/slop. Don't post low-hanging fruit here.

founded 4 years ago
MODERATORS
 

Here is the lemmygrad post I made it at (don't wanna have to copy everything over).

Please give the post lots of heart-sickle, the post would really appreciate it

Don't be afraid to ask questions.

you are viewing a single comment's thread
view the rest of the comments
[–] Sebrof@hexbear.net 2 points 1 week ago (16 children)

I have some comments, questions, and possible suggestions. I think this is really great, and simulations are incredibly fun and I love digging into them. Some of my questions are because I know Python but not MatLab, so I may need to check I understand what your code is doing. Other comments may be due to differences in how quantities are calculated (particularly how the labor-value and the costs were calculated), and your final comparison of aggregated quantities instead of sector quantities. Keep in mind that I don’t mean any comment to sound aggressive, and it is possible that I am misunderstanding the code or the concept that the calculation represents.

Because I don’t know MatLab well, I’m going to go through the sections of the code and we can confirm my understanding of each part.

1.) You make N economic simulations. For each iterative economic simulation, i, you:

2.) First, generate a random net product vector n for the global economy (you call it o in the simulation).

3.) Then you randomly generate an input output table A.

  • Warning: not every randomly generated input output table is productive, i.e. there is no guarantee that the inverse of I-A exists, or that if it does exist then you will have an economically feasible gross product. The Hawkins-Simons condition (which is an economic application of the Perron-Frobenius theorem) gives us the mathematical conditions for ensuring that an input output matrix A is economically feasible.
    • Essentially for A to be productive, (I-A)^-1^ must exist and (I-A)^-1^ n must result in a non-negative vector (you can’t have a requirement of negative gross production) which means (I-A)^-1^ must also be non-negative. -- To confirm that A is productive. You can check if the largest eigenvalue of A. If it is a positive value that is less than one then by the Hawkins-Simon theorem it will be productive. -- Alternatively, you could just randomly generate the input output matrix A and then confirm that (I-A)^-1^ exists and is non-negative. If not, regenerate A and test again. -- I am also sure that MatLab would give an error if the matrix inverse does not exist, but it won’t give an error if the resulting gross product is not non-negative.

4.) Then you calculate the gross product vector q, or as you call it O. This is calculated via q = (I-A)^-1^ n. It took me a while to realize that “\” is MatLab’s way of doing a matrix inverse followed by a multiplication. So A \ b is MatLab’s way of calculating A^-1^b, correct?

5.) You calculate the gross labor use as L=l q. This is element wise multiplication, or equivalently, the dot product. I wasn’t sure why you normalized the net product and the gross labor, though.

[–] Sebrof@hexbear.net 2 points 1 week ago (11 children)

6.) Calculating the LTV “prices” is the part that confuses me the most and I have a few comments and questions on

  • You calculate this by first calculating (I-A)^-1^, and then perform an element-wise multiplication (this is what “.*” does in MatLab, correct?) by the labor coefficient vector l. Then you sum this together.

  • I am confused by this calculation as the standard equation for calculating labor values is v = v A + l = l (I-A)^-1^. Note that l is a 1 x n row vector and so v is also a row (or left) vector. Alternatively, you could calculate with column vectors and the transpose of the inverse, i.e. v = ((I-A)^-1^)^T^ l.

This gives you the amount of labor required in a vertically integrated subsystem to produce one unit net product. This is using Sraffa and Pasinetti’s work to give a more concrete theoretical understanding of what a labor-value is. It is like a total labor input per unit net product. By that definition, though, it isn’t meaningful to sum up these elements as they don’t have the same units. You would first have to multiply v by some commodity-quantity, typically the net product. Note that v n = L, this provides an alternative way to “dividing up” the economy’s social labor.

  • This is similar to how you couldn’t actually meaningful sum up the elements of a price vector, p. A price has the units of money per unit commodity, and each commodity would hence have a different price unit. You would first have to multiply each price by the quantity of commodities that one is purchasing in order to convert it to a common unit (money) and then you could add it up. The same logic works for the standard definition of the labor value vector.

  • Another reason to not sum the value vector is that it would be useful to compare each element of the value vector, i.e. each commodity’s labor value, to the emergent price in the market. But, this would require you to add a mechanism where each firm can adjust prices and I don’t believe that has been added into the model yet. At the moment you are comparing aggregate quantities, i.e. the sum of prices with the sum of values-per-commodity (which I am not confident is meaningful in your present calculation), but an improvement could be to compare each sector’s emergent price (the price required for reproduction) with the sector’s labor value. In another post I have some papers where you can read how Ian Wright’s simulations handle the price adjustment and the reallocation of labor. This can be one possible future direction to head toward. I.e. you can inspect the ratio of p~i~ / v~i~ for each sector i.

[–] sodium_nitride@hexbear.net 1 points 1 week ago (1 children)
  1. uh, I haven't really read staffa or anything, but my approach for computing ltv prices was

Assume 1 unit of net output for a commodity

Calculate how much gross production would required for each sector in that case

Element wise multiply this with direct labor use to get needed labor from each sector

Add up all of the labors from all the sectors.

In formal terms, for sector 1

(I-A)^-1 * [1;0] = g = Gross product for 1 unit of sector 1

Then

sum(g.*l)

The "(eye(n)-A)\eye(n))" computes "g" for every sector at once (the output is [g1 g2 g3 g4 ...])

I believe this is equivalent to the equation you have also provided, except your equation involves fewer steps.

Also, just as a context thing, matlab, for some reason sums matrices down columns by default. So the output the ltv prices equation is a row vector of the summed labors (which I transpose using the apostrophe symbol ')

Indeed I am pretty sure that my code actually is using prices and values for each sector separately, otherwise the code should be giving me an error regarding the dimensionality of the code.

[–] Sebrof@hexbear.net 2 points 1 week ago (1 children)

Hello again, I'm going through your code and taking some notes so I am getting back to you in sections. I plan on putting everything in one post, but I thought I could comment on this particular point separately in the meantime. Also, apologies if I come across as if I am speaking down you. I recognize you are acquainted with these ideas and I'm trying to be clear to avoid any confusion for both of us and anyone else reading these comments!


The way that you calculated labor values here can work, as long as you are multiplying the labor coefficients across columns in a row when doing the element-wise multiplication. If done correctly, you are correct in that you are essentially calculating

v = v A + l = l (I - A)^-1^

which is the total labor required to produce a unit net product.

I have an example here to make my point:

  1. Here is my labor coefficient vector, l

  2. Define Leon as the Leontief inverse matrix (I-A)^-1^

MatLab trips me up with the \ operator, so I just take the inverse explicitly and define it as Leon to avoid any confusion.

This will be a little different form your approach where you are taking Leon and then matrix-multiplying by unit vectors (a matrix of unit vectors i.e. I) to perform the sum. Here, I make the sum more explicit to step through the calculation.

  1. Calculate the total labor it takes to produce a unit of net output, i.e. a (standard) labor-value.

Since I am not familiar with MatLab I am not claiming you are doing this the correct or incorrect way - you can determine this since you know MatLab better than I do - but I wanted to show you a possible wrong way to calculate v depending on how you do the element-wise multiplication.

Incorrect Way If the labor coefficient value l~i~ is multiplied to the values in the i-th column of the Leon matrix and you sum the values of each column (sum across rows for column i) as shown below:

Then you will be getting a vector that doesn't correctly trace the labor inputs of each sector.

You would be accidentally calculating

(I - A)^-1^ l

i.e. you would be defining v~i~ as Leon~i,1~ l~1~ + Leon~i,2~ l~2~ + ...

instead of correctly calculating it as

Correct Way

l (I - A)^-1^

i.e. v~i~ = l~1~Leon~1,i~ + l~2~ Leon~2,i~+ ...

The order of the subscripts helps keep this straight, since the embodied labor in net product i is the sum of labor going from sector 1 to sector i plus labor going from sector 2 to sector i plus ..., etc.

As long as your method is doing the element-wise multiplication correctly then it will work. Here are the examples I have continued:

Here, as long as the first element of l is being multiplied to the first row of Leon, and the second element of l by the second row of Leon and etc. then when you sum the columns

you get the correct calculation of the labor value, which the above shows.


My apologies for the earlier misunderstanding. I see that you are not aggregating

[–] sodium_nitride@hexbear.net 2 points 1 week ago (1 children)

Matlab element wise multiplication indeed works in the correct way that you described.

sum(Leon.*l)

is equivalent to

l*Leon

which is why MatLab's "sum" function by default sums down columns rather than by rows. The sum(Leon.*l) notation keeps things explicit (helps me in coding consistently), but the MatLab compiler knows how to optimize these things.

[–] Sebrof@hexbear.net 2 points 1 week ago

Thanks for the response! Hopefully I'm not overloading you with questions - this is helping me understanding MatLab and answering some other questions I had. I've asked another question too re. the wages for whenever you have the time.

Thanks again!

load more comments (9 replies)
load more comments (13 replies)