Skip to content
  • Home
  • Latest Blogs
  • Forums
  • Feed
  • Resources
  • Rules/FAQ
  • Chatroom
  • Donate
  • Login
  • Register

CASPER Forum

Computational and Statistical Political Economy Research

  • Forums
  • Members
  • Recent Posts
Forums
Political Economy
Cybernetics
Sector Centrality 2...
 
Notifications
Clear all

Sector Centrality 2021 U.S I/O tables

    Last Post
  RSS
Ivan Williams
 Ivan Williams
(@madredalchemist)
Estimable Member

Finally got around to passing the most recent data into the page rank algo. I didn't weight it this time because I didn't have the industry by industry labor content and I don't know what to make of the sector-sector prices (I'm using this https://apps.bea.gov/iTable/?reqid=150&step=2&isuri=1&categories=Io#eyJhcHBpZCI6MTUwLCJzdGVwcyI6WzEsMiwzXSwiZGF0YSI6W1siY2F0ZWdvcmllcyIsIklPIl0sWyJUYWJsZV9MaXN0IiwiNjAwMCJdXX0= ) so this is just plain page-rank. 

Notable that Machinery, Computers & Electronics, Motor Vehicles (and associated products) score the highest and that wood products, minerals, and metals score the lowest.

Where'd I find the labor content for these same sectors?

Anyway, here's the PageRank Centrality for U.S I/O 2021  

['Farms6.9843573300080015' 'Forestry, fishing, and related activities3.0189546941902115' 'Oil and gas extraction2.4362916920056077' 'Mining, except oil and gas3.2183699815244164' 'Support activities for mining2.556057468796985' 'Utilities2.443260441544314e-05' 'Construction2.443260441544314e-05' 'Wood products1.6151163990775356e-15' 'Nonmetallic mineral products7.019023566910198e-16' 'Primary metals2.5641896891960762e-17' 'Fabricated metal products0.2619941111955933' 'Machinery11.309162297595659' 'Computer and electronic products11.309162297595659' 'Electrical equipment, appliances, and components2.638519093077346' 'Motor vehicles, bodies and trailers, and parts11.13908067852122' 'Other transportation equipment1.7429297553268426' 'Furniture and related products1.7429297553268426' 'Miscellaneous manufacturing1.7897991053934397' 'Food and beverage and tobacco products1.7505760226160056' 'Textile mills and textile product mills1.1346367883413317' 'Apparel and leather and allied products1.1346367883413317' 'Paper products1.7073428749082717' 'Printing and related support activities1.7073428749082717' 'Petroleum and coal products0.0019571791339500415' 'Chemical products1.4164465838584883' 'Plastics and rubber products1.2612479978414193' 'Wholesale trade0.8553208927587204' 'Motor vehicle and parts dealers2.5990169407552055' 'Food and beverage stores2.211494284941866' 'General merchandise stores2.2032977007611674' 'Other retail2.276196282876631' 'Air transportation2.276196282876631' 'Rail transportation1.8815700378724656' 'Water transportation1.8815700378724656' 'Truck transportation2.079903410584055' 'Transit and ground passenger transportation0.30158717938543234' 'Pipeline transportation0.30158717938543234' 'Other transportation and support activities1.8243278581437476' 'Warehousing and storage0.4072398609007258' 'Publishing industries, except internet (includes software)0.47412875287058237' 'Motion picture and sound recording industries0.47412875287058237' 'Broadcasting and telecommunications0.580807599321912' 'Data processing, internet publishing, and other information services0.9572158098729701' 'Federal Reserve banks, credit intermediation, and related activities0.7014336375138344' 'Securities, commodity contracts, and investments0.5066563382522222' 'Insurance carriers and related activities2.4737577125019174' 'Funds, trusts, and other financial vehicles0.06367229495628614' 'Housing2.009833037000016' 'Other real estate0.130772851106417' 'Rental and leasing services and lessors of intangible assets0.006125544062927019' 'Legal services0.0026644909241400534' 'Computer systems design and related services0.012889769875216776' 'Miscellaneous professional, scientific, and technical services0.016599046902375205' 'Management of companies and enterprises0.007418421129861582' 'Administrative and support services0.01124114365560956' 'Waste management and remediation services0.01124114365560956' 'Educational services0.02583831709865851' 'Ambulatory health care services0.039526314303911785' 'Hospitals0.04053884521311496' 'Nursing and residential care facilities0.04053884521311496' 'Social assistance0.023248469357163938' 'Performing arts, spectator sports, museums, and related activities0.023248469357163938' 'Amusements, gambling, and recreation industries0.0010554100686806852' 'Accommodation9.732384672752608e-05' 'Food services and drinking places0.0018095081607738858' 'Other services, except government0.0005740234597283036' 'Federal general government (defense)0.0005183043839862668' 'Federal general government (nondefense)0.0005161061939674822' 'Federal government enterprises0.0001675568673399331' 'State and local general government0.0001675568673399331' 'State and local government enterprises0.00026952858784066807' 'Scrap, used and secondhand goods0.00013599140873930937' 'Noncomparable imports and rest-of-the-world adjustment1.0898308995052032e-05']

and the google Colab code:

from google.colab import files
import pandas as pd

# Upload the file
uploaded = files.upload()

import numpy as np
import matplotlib.pyplot as plt 
from numpy import linalg as LA

# Assuming you've uploaded the 'table.csv' file and loaded it into the 'data' DataFrame
data = pd.read_csv('TableCCI-O.csv', skiprows=4, skipfooter=4, engine='python')

IO = data.iloc[:, 2:].values

# Now 'data' contains the DataFrame with the correct delimiters
print(IO)
print(LA.inv(IO))

theta = 0.0
gamma = 0.85 
N = 73

def Adj(M): return 1.0*(M>0) #connectivity

def C(M): return 1.0*(M==0.0) #correction

#def WaP(M): return ((1/(M+C(M)))-C(M))*Adj(M) #weight against price

def WaP(M): return M*Adj(M) #weight at price

def S(M): return np.diag(1/(WaP(M)@(np.ones(N).T))) #out strength

def D(M): return np.diag(1/(Adj(M)@(np.ones(N).T))) #out degree

def WPR1(M): return ((theta*S(M)@WaP(M)) + ((1-theta)*D(M)@Adj(M))).T 

def WPR2(M): return (gamma*WPR1(M)) + ((1-gamma)*np.ones((N,N))/N) #weighted page rank matrix 

print(Adj(IO))

print(WaP(IO))

print(WPR2(IO))

eigval, eigvec = LA.eig(WPR2(IO))
names = data.iloc[:, 1:2].values.flatten()
rank = 100*abs(eigvec[0])/np.sum(abs(eigvec[0]))

srank = rank.astype('str')

results = names + srank  #bug
print(results) #weighted page rank
Quote
Topic starter Posted : 17/08/2023 12:45 am
Ivan Williams
 Ivan Williams
(@madredalchemist)
Estimable Member

Link to a comrade's terminal version:

https://codeberg.org/skesisritesactivist/ioaccounting/src/branch/feature/conventions/ioaccounting.py

ReplyQuote
Topic starter Posted : 17/08/2023 10:39 am
Ivan Williams
 Ivan Williams
(@madredalchemist)
Estimable Member

*python version you can run from the terminal

ReplyQuote
Topic starter Posted : 17/08/2023 12:41 pm
skesis rites activist
 skesis rites activist
(@skesisritesactivist)
New Member

This has captured my imagination. I'm trying to operationalize this a bit to be more 'exploratory' (i.e., manipulate values etc., identify disconnected industries etc.)

I'm a programmer, though, my mathematics skills have atrophied dramatically over time

ReplyQuote
Posted : 17/08/2023 6:19 pm
Ivan Williams
 Ivan Williams
(@madredalchemist)
Estimable Member

@skesisritesactivist Here's the paper I crib from, I'm not a computer scientist so I'm taking the author's at their word that it works as intended.

I get the gist of the math; take a recursive algo --> make it a matrix operation, but I don't have proper experience in graph theory so if you know anyone with that background toss it over to em'.

 WPR.pdf
ReplyQuote
Topic starter Posted : 17/08/2023 7:07 pm
Ivan Williams
 Ivan Williams
(@madredalchemist)
Estimable Member

@skesisritesactivist Anything you can add would be great! I wanted the project to move towards a kind-of "anti-nasdaq" where unions can use it autonomously to identify when/where the bosses are weakest; higher variety of tactics = higher chance of of victory.

Ultimately the "big gun" (most resources but highest payoff) would be something like an 'optimal strike' where we use these I/O tables to figure out which unions need to organize together for the largest loss to the bosses with the least amount of member-time on strike.

ReplyQuote
Topic starter Posted : 17/08/2023 7:21 pm
Ivan Williams
 Ivan Williams
(@madredalchemist)
Estimable Member

@skesisritesactivist It needs a UI too. You know those social media graphs showing all the connections between various pages, groups, people etc? One of those where the nodes are scaled by various things, centrality, labor content etc. would be great! very neurathian too lol

ReplyQuote
Topic starter Posted : 17/08/2023 7:58 pm
Forum Jump:
  Previous Topic
Next Topic  
  Forum Statistics
16 Forums
119 Topics
582 Posts
0 Online
7,356 Members

Latest Post: Software for I/O planning for Co-ops? Our newest member: ahcodefey Recent Posts Unread Posts Tags

Forum Icons: Forum contains no unread posts Forum contains unread posts

Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

 

Open Chatroom

Login required


Copyright © 2023 CASPER Forum.

Powered by PressBook Child WordPress theme