Economics should be open

July 27, 2009

Input Output Table, generating from BEA data

Filed under: Uncategorized — howardchong @ 6:52 pm

I struggled a bit in putting together an input output  table (IO table) for the US economy in doing my research on the impact of carbon prices on industrial activity.

Here I include Octave (compatible with MATLAB) code to generate an input output table given 3 inputs from the Bureau of Economic Analysis:

  1. Total consumption
  2. Industrial activity linked to commodity (USE)
  3. Industries and how much of each commodity they produce (MAKE)

More…

First, some links:

http://www.the-idea-shop.com/article/197/building-an-input-output-table-from-bea-make-and-use-tables

http://en.wikipedia.org/wiki/Input-output_model

http://www.eiolca.net/

The first link describes how to reformat the BEA data into what we’re used to. I use their definitions of M and U. TOTAL is the 133 x 1 matrix of Total Industrial Output (T008). The wikipedia article gives background and a discussion of how the tables are usually formatted. The EIOLCA is a program to use IO analysis to look at environmental impacts. The car uses aluminum, the aluminum uses electricity, the electricity uses coal mining, etc.

What I show you is how to get the (I-A)^-1  matrix. Once you get this, then you can multiply it to any consumption profile to get the full impact of a marginal change in production.

Code is below.

NOTE: I don’t show you how to get M and U and TOTAL into your computing program. Read the Ideashop article for that.

NOTE2: You (probably) cannot do this in excel because it has a limit on the maximum size of a matrix it will invert.

====

# Code to generate Input-Output Model for US economy
# and extract the electricity (and other fuel) components.
# Akin to the methods of EIO-LCA (Economic Input Output – Life Cycle Analysis)
# Howard Chong ; July 27, 2009
cd(“F:/octave”)
load IO_U.csv
load IO_M.csv
load TOTAL.csv
*# M is a mapping of the industries to the commodities produced. (Each industry typically produces 1 commodity, but some produce many)
## U is a mapping of the commodities produced to the economic activity that is required to produce it.
## U is mapped in the standard way.
## The standard way is: element u_ij is the amount of i (row) used in producing j (col).
## this took some time to sort out
## see “C:\Documents and Settings\Howard\My Documents\UCEI\Bushnell EU Carbon\stage2\Project Management47 – input output tables\practice” and
# the USE table says “For the distribution of commodities consumed by an industry, read the column for that industry”
# This corresponds to the columns which are “inputs to XXX”.
IO_TOTAL=TOTAL;
M=IO_M;
U=IO_U;
MU=(M*U);
# To get A, we need to divide each column by the same denominator; the total production. To do this we:
# 1) multiply TOTAL (as a column vector) with a row vector of ones This creates a vector with all the rows the same.
# 1.5) transpose 1
# 2) element-wise divide MU by TOTAL.
TOTAL=IO_TOTAL;
TOTAL=TOTAL’; #make column vector
N=size(TOTAL,1);
T=(TOTAL*ones(1,N))’;
A=MU./T;
IOMAGIC=inverse(eye(N)-A);
# IOMAGIC is the matrix that gives the total consumption. That is, INPUTS_NEEDED=IOMAGIC*CONSUMPTION
# A gives the “direct” impacts.
# I gives the one unit of the good purchase
# A good identity to check is TOTAL=IOMAGIC*FINALCONSUMPTION
# where FINALCONSUMPTION = TOTAL – INTERMEDIATE_CONSUMPTION
intermediate=sum(MU,2);
final=TOTAL-intermediate;
test=IOMAGIC*final-TOTAL;
max(abs(test))
# A second check is to make sure the food production (17) uses crops (1) but that crops don’t use food production
eyeN=eye(N);
buyfood=eyeN(:,17);
buycrops=eyeN(:,1);
testfood=IOMAGIC*buyfood;
testfood(1)
testcrops=IOMAGIC*buycrops;
testcrops(17)

# Code to generate Input-Output Model for US economy

# and extract the electricity (and other fuel) components.

# Akin to the methods of EIO-LCA (Economic Input Output – Life Cycle Analysis)

# Howard Chong ; July 27, 2009

cd(“F:/octave”)

load IO_U.csv

load IO_M.csv

load TOTAL.csv

*# M is a mapping of the industries to the commodities produced. (Each industry typically produces 1 commodity, but some produce many)

## U is a mapping of the commodities produced to the economic activity that is required to produce it.

## U is mapped in the standard way.

## The standard way is: element u_ij is the amount of i (row) used in producing j (col).

## this took some time to sort out

## see “C:\Documents and Settings\Howard\My Documents\UCEI\Bushnell EU Carbon\stage2\Project Management47 – input output tables\practice” and

## http://en.wikipedia.org/wiki/Input-output_model#Key_Ideas

# the USE table says “For the distribution of commodities consumed by an industry, read the column for that industry”

# This corresponds to the columns which are “inputs to XXX”.

IO_TOTAL=TOTAL;

M=IO_M;

U=IO_U;

MU=(M*U);

# To get A, we need to divide each column by the same denominator; the total production. To do this we:

# 1) multiply TOTAL (as a column vector) with a row vector of ones This creates a vector with all the rows the same.

# 1.5) transpose 1

# 2) element-wise divide MU by TOTAL.

TOTAL=IO_TOTAL;

TOTAL=TOTAL’; #make column vector

N=size(TOTAL,1);

T=(TOTAL*ones(1,N))’;

A=MU./T;

IOMAGIC=inverse(eye(N)-A);

# IOMAGIC is the matrix that gives the total consumption. That is, INPUTS_NEEDED=IOMAGIC*CONSUMPTION

# A gives the “direct” impacts.

# I gives the one unit of the good purchase

# A good identity to check is TOTAL=IOMAGIC*FINALCONSUMPTION

# where FINALCONSUMPTION = TOTAL – INTERMEDIATE_CONSUMPTION

intermediate=sum(MU,2);

final=TOTAL-intermediate;

test=IOMAGIC*final-TOTAL;

max(abs(test))

# A second check is to make sure the food production (17) uses crops (1) but that crops don’t use food production

eyeN=eye(N);

buyfood=eyeN(:,17);

buycrops=eyeN(:,1);

testfood=IOMAGIC*buyfood;

testfood(1)

testcrops=IOMAGIC*buycrops;

testcrops(17)

Advertisements

4 Comments »

  1. FYI, you’ll be able to do the inverse matrices in Excel 2007 or later. In those versions, they’ve greatly increased the size of the maximum matrix multiplication. I’ve done 130 x 130 matrix multiplications in Excel 2008 for Mac, and that should be large enough for almost I-O table calculations.

    Thanks for the link!

    Comment by Andrew Chamberlain — August 25, 2009 @ 7:51 pm

  2. Thanks for the interesting article!

    Comment by Sergio — September 13, 2010 @ 10:08 am

  3. Unless I’m missing something, Andrew no longer has the methodology paper available in the link you’ve provided. There is however a simple paper from the BEA. It is buried in a zip file at: http://www.bea.gov/industry/zip/2002detail_redef.zip

    Comment by Nicholas Potter — December 16, 2010 @ 10:37 am

    • Yup, Andrew seems to have put his instructions behind a pay wall. . His prerogative. The technique is simple enough for anyone with some economics proficiency. I haven’t taken a look at the BEA article, but thank you for the link.

      Comment by howardchong — December 17, 2010 @ 8:15 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: