Go to: [Data Set index]
This document contains R code that can be used to transform two-mode service value matrices (svm) into one-mode inter-city connectivity matrices (icc) using the interlocking network model (inm) (Taylor, 2001), and subsequently compute the global network connectivity (gnc) for every city. Details on the input matrices, the model, and its output can be found in Taylor and Derudder (2016).
R is a free software environment that provides a wide variety of statistical techniques. R needs to be downloaded, together with a development environment that supports direct code execution, and tools for plotting, history, debugging and workspace management. We used Rstudio and generated this document with R Markdown. R Markdown is designed for easier reproducibility, because both computing code and narratives are in the same document. The code runs with the “dplyr”-package. The below example refers to the 2018 data as shown by the file names, but the code works with any other service value matrix in .csv-format as long as it is properly structured.
Basically, three steps are explained in this brief guide: (i) creating a numerical service value matrix; (ii) computing the inter-city connectivity matrix and (iii) generating a table with global network connectivities.
Step 1 - Creating a numerical service value matrix
First of all, GaWC’s two-mode service value matrix needs to be read and stored. Data are stored in a dataframe called ‘svm’ with the following code:
A dataframe can contain characters, strings and numbers, and is therefore not fit for matrix algebra. We extract the cities and firms from the dataframe and transform what is left into a numerical matrix ‘svm_mat’ (dimensions: 175 firms x 707 cities) as follows:
Step 2 - Constructing inter-city connectivity matrix
The icc matrix is basically the product of the svm matrix and its transpose (Derudder, 2020). This can easily be done with the tcrossprod-function. Keep in mind that the diagonals are zero.
Step 3 - Calculating global network connectivity for every city
To calculate absolute and relative global network connectivity for every city, we use code that calculates the total icc-value for every city (which is the absolute GNC-value), and sorts the output. We add a GNC_rel value and a rank to the table.
* Tom Storme and Ben Derudder, SEG Research Group, Ghent University, 1 April 2020