A Technical Note on Spatial Aggregation for Independent Cities and Counties in Virginia

Jing Chen

RRI TechDoc 2017-03

Key words/Codes: Spatial Aggregation, Virginia, Independent Cities, Python; R00, Y10

View Document (6 pp. 289 KB)


This document provides an overview of two approaches to treat Virginia’s independent cities in county-level data sets. Then, issues of spatial aggregation and geographical division change are introduced respectively. A Python function for spatial aggregation is also provided. Although this document focuses on independent cities and counties in Virginia, it can be extended into other regions for spatial aggregation.

Computing Coal Dependent Employment Estimates

Randall Jackson

RRI TechDoc 2017-02

Key words/Codes: Input-output, employment proportions,
coal dependence

View Document (6 pp. 302 KB)


This document presents the basis for estimating coal-dependent
employment in a reference region, then establishing a weighting factor
for each industry that can be used to provide a quantitative estimate
of the existing employment or employment change in a county that can
be attributed to existing or change in coal employment. The Matlab
function is provided. Although coal is the industry of interest in this
document, any other industry could be targeted for similar study.

Using R and Google-API tools to estimate geographic features

Juan Tomas Sayago Gomez

RRI TechDoc 2017-01

Key words/Codes: Geocode, Elevation, distance matrix

View Document(4 pp. 293KB)
Supporting Files


This technical document is a guide for using Google APIs to find information for research purposes. First, I apply the code to find the elevation at a given set of coordinates for specific locations. Second, I apply the code to find the street distances between two or more sets of coordinates. All the codes and sample files are available in the zip file attached to this guide.


Object-Oriented Interindustry Systems: Proof of Concept

Péter Járosi and Randall Jackson

RRI TechDoc 2015-03

Key words/Codes: Object oriented modeling, Interindustry Systems, Python; C67, C68, C63, R15

View Document (15 pp, 341 KB)
2015_3 Supporting Files


This document provides a proof-of-concept demonstration of an object-oriented approach to modeling an inter-industry system. The example framework uses a small CGE model based on a three-sector social accounting matrix (SAM). The economy is shocked by changing total factor of productivity in the production function, the new equilibrium is determined in classical CGE fashion, and the original SAM is updated to conform to the new equilibrium solution. In this way,the efficiency of the Object-oriented modeling (OOM) approach can be emphasized in the context of the computational simulations of inter-industry systems by a simpli fied CGE example written in Python. Since this example implemented as only a possible application of the OOM, the proof of the concept should be interpreted as a particular but among the most difficult economic modeling cases.

MATLAB and Python Functions for Weighted Disaggregation

Amir Borges Ferreira Neto and Randall W. Jackson

RRI TechDoc 2015-02

Key words/Codes: Matlab, Python, Weight Disaggregation;C67, R13

View Document (7 pp, 348 KB)


This technical document describes a weighted disaggregation problem and provides the code for a function in MATLAB and Python to perform such disaggregation.

Location Quotient, Coefficient of Specialization and Shift-Share

Juan Tomas Sayago-Gomez and Caleb Stair

RRI TechDoc 2015-01

Key words/Codes: Location Quotient; Coefficient of Specialization and Shift-Share

View Document (12 pp, 346 KB)
Supporting Document


This technical document describes the foundations for three
different regional economic functions implemented in MATLAB and R.
These functions are Location Quotients, Coefficients of Localization,
and Shift-Share Analysis.


Setting up a SAM in Excel using VBA

Amir Borges Ferreira Neto

RRI TechDoc 2014-05_v2

Key words/Codes: CGE, SAM, Spreadsheet, Excel; C68, R13

View Document (10 pp, 269KB)


This technical document describes how to set up a full Social Accounting Matrix from its own partition in a spreadsheet file. This is done using VBA code.

Using a Spreadsheet SAM for GAMS CGE Modeling

Amir Borges Ferreira Neto

RRI TechDoc 2014-04_v2

Key words/Codes: CGE, SAM, Spreadsheet, Excel; C68, R13

View Document (11 pp, 295KB)


This technical document provides in a single document a template to follow when using spreadsheet Social Accounting Matrix data to drive a GAMS-based Computable General Equilibrium model.

Disaggregating Input-Output Models

Xueting Zhao

RRI TechDoc 2014-03

Key words/Codes: Disaggregate, Input-Output, C67, Q53, R15

View Document (11 pp, 357 KB)


This Technical Document describes the steps to disaggregate an industry sector in an I-O table using Python. A disaggregation method that based on weight factors is used in this document. The calculation has three parts. The first part is to calculate the disaggregated input matrix DIM, which represents all the input from common sectors into the new sectors. The second part is to calculate the disaggregated output matrix DOM, which represents all possible output weights of new sectors into common sectors. The last part is to calculate the intra matrix DINM, which represents the allocation of intra-industry sales in the disaggregated sectors. This document states the problem and introduces the calculation method of the paper by Wolsky (1984), then follows with an example based on the data of the paper by Linder et al. (2013).

Technical Document for Price Adjustment

Zheng Tian, Mulugeta Kahsai, and Randall Jackson

RRI TechDoc 2014-02

Key words/Codes: Input-Output Models, price changes, energy; C67, C53, Q47, Q41

View Document  (6 pp, 309 KB)
Supporting Document


This document presents the basis for the price adjustment mechanisms in a time series IO model. The essentials of the price adjustment and price change propagation algorithms are presented, along with a matrix permutation algorithm that facilitates the implementation of the price adjustment mechanism. The Matlab function is provided.

Matlab Code for Structural Decomposition Analysis

Juan Tomas Sayago-Gomez

RRI TechDoc 2014-01

Key words/Codes: Structural Decomposition Analysis, Input Output, RAS procedure

View Document (14 pp, 249 KB)
Supporting Document


This TechDoc describes the steps necessary to apply the Structural Decomposition Analysis (SDA) using Matlab. The code has two stages. The first stage, which comprises PrepSDA.m and RAS_SDA.m, prepares the data and the input required for SDA based on the accounting identities defined in Miller and Blair (2009) and Jackson and Schwarm (2011). The second stage (SDA.m) carries out the analysis and estimates the results based on the mathematical procedure in Yang and Lahr (2010) and Zhang and Lahr (2014). The end results can be exported into a csv file.


Generating MATLAB Matrices from IMPLAN CGE Files

Mason Pierce

RRI TechDoc 2013-05

Key Words/Codes: IO, IMPLAN

View Document (6 pp, 380 KB)
Supporting Document


This document describes the process used to create usable tables from the 27 individual GAMS files in .DAT format generated by IMPLAN software. 26 of these are social accounting matrix (SAM) data files and 1 is an employment-by-industry data file. By performing the appropriate command in MATLAB, the user can create the desired table, for example use or make tables, which can then be used for various purposes.

IMPLAN 2 and IMPLAN 3 produce .DAT files of different formats. This document details the process of handling each of these file formats.

An Aggregation Matrix MATLAB Function

Caleb Stair

RRI TechDoc 2013-04

Key Words/Codes: Aggregate/Aggregation Matrix/Input-Output

View Document (5 pp, 471 KB)


This Technical Document describes the foundations for an aggregation matrix function implemented in MATLAB, including the format and structure of the required aggregation vector used as an argument to the function. The function is passed with the N-dimensional aggregation vector as an argument. The aggregation vector contains N values ranging from 1 to M, each of which is the aggregate index corresponding to the N pre-aggregation indices. The function returns an aggregation matrix with M rows and N columns. Pre-multiplying an existing matrix with N rows by the aggregation matrix reduces the row dimensionality from N to M by adding the sectors to be aggregated.  Post-multiplication by the transpose of the aggregation matrix reduces the column dimensionality from N to M accordingly.

Integrating Input-Output and Life Cycle Assessment: Mathematical Foundations

Randall W. Jackson

RRI TechDoc 2013-03

Moved to Resource Documents #2013-02

Composite Input-Output Production Functions

Randall W. Jackson

 RRI TechDoc 2013-02r1-2

Key Words/Codes: I/O

View Document (2 pp, 288 KB)


This document describes the algorithm used for creating an aggregated linear production function for an industry by weighting subsector production functions. The result can be used as a column in an interindustry (IxI) coefficients table or in a standard Use table (CxI) depending on the units (C or I) of the input data.

Integrated Modeling Frameworks

Randall W. Jackson

RRI TechDoc 2013-01

Moved to Resource Documents #2013-01