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 1 points 1 week ago* (last edited 1 week ago)
  1. correct

  2. correct

  3. I was under the impression that since matlab's "rand" generates values between 0 and 1, all of the technical matrices should be automatically productive, but you are correct. I should add explicit checks

  4. yes

  5. I normalise the net product so that different economies are more comparable to one another. I am interested in the ratio of output between 2 industries, and not the scale of overall production

I normalise the gross labor use because that variable should actually be "share of workforce employed". The name is a relic from my previous attempt at the code where I had tried to incorporate the population into the sim. I seem to have forgotten to change the name.

Matlab's elementwise multiplication is not a dot product

load more comments (15 replies)