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.

[–] sodium_nitride@hexbear.net 2 points 1 week ago* (last edited 1 week ago)

I added in the explict checks. It turns out, a huge number of the matrices being produced were non-productive. Instead of trying to keep generating matrices, I made a different fix (which makes the technical matrices more realistic, so win-win)

I made it so that the average number of entries in each row of the technical matrix is (2*n)^0.5

This means that as the economy grows larger, the matrices grow sparser. This makes productive matrices much more likely (at which point, I just have a check which makes it so that non-productive matrices are regenerated).

Curiously, this change doesn't have that big of an effect on the outcome. I've verified. The model simply handles negative net production and treats it like purchasing commodities from the external market (so something like imports). Still, I have removed it for now.

load more comments (15 replies)