Zonohedron software: a short guide


This webpage describes how to replicate the toy example presented in the
paper 'Production theory: accounting for firm heterogeneity and
technical change', authors: Giovanni Dosi, Marco Grazzi, Luigi
Marengo, Simona Settepanella. The same instructions can be used to
perform analysis on 'real' firm-level data.
Latest update: Marco Grazzi, May, 21 2015

Table of Contents
1. Software and system requirements
2. Files and directories
3. Using the program ./zonohedron
4. Plots with gnuplot
5. Zon(n)ohedron


1. Software and system requirements

Zonohedron is a simple command-line program that computes a zonohedron
out of a collection of vectors. It's written in C++ without
dependencies and thus available for every platform, it's quite fast
and can process zonohedra with thousands of generators in a short
time. Zonohedron has been written by Federico Ponchio and can be downloaded here.

The following set of instructions has been performed on a linux system.
The same can also be done under Windows, provided that gygwin is installed.

Replication of plots of the paper also requires the following softwares: gnuplot ; gbutils ; meshlab

2. Files and directories

To replicate the toy example locate into the same folder as zonohedron and paste
the followings lines of code in command line interface.
The following 4 lines generate the firms-vectors employed in the example (Table 1 of the paper):
echo -e ' 8 2 10 \n 2 8 10 \n 6 2 9 \n 3 3 8 \n 3 3 6 \n 6 6 4 \n 2 2 9 \n 6 5 4 \n 6 2 3 \n 3 7 4' > toy2-example-data_1.txt
echo -e ' 8 2 10 \n 2 8 10 \n 6 2 9 \n 3 3 8 \n 3 3 6 \n 6 6 4 \n 2 2 9 \n 3 5 12 \n 2 2 11 \n 2 6 10' > toy2-example-data_2.txt
echo -e ' 8 2 10 \n 2 8 10 \n 6 2 9 \n 3 3 8 \n 3 3 6 \n 2 2 9 \n 3 5 12 \n 2 2 11 \n 2 6 10' > toy2-example-data_3.txt
echo -e ' 8 2 10 \n 2 8 10 \n 6 2 9 \n 3 3 6 \n 2 2 9 \n 3 5 12 \n 2 2 11 \n 2 6 10' > toy2-example-data_4.txt

3. Using the program ./zonohedron

The software zonohedron allows to compute the measures employed in the
paper, such as volume of the zonotope, gini volume, solid angle, angles
accounting for productivity change and change in the intensity of input
intensities, elasticities of substitution. To get the values reported in
Table 2 the paper, run the following four lines for each year of the example.

./zonohedron toy2-example-data_1.txt toy2-example-data_1.obj
./zonohedron boundary.txt
gbget 'toy2-example-data_1.txt' -t '<( (x1^2) + (x2^2) + (x3^2) )^.5>' | gbget '()' 'toy2-example-data_1.txt' | gawk '{print $2/$1, $3/$1, $4/$1}' > tmp_file
./zonohedron tmp_file

The first line computes the measures of interest for the zonotope
generated by the original firms-vectors. The output file (.obj) can be
imported into meshlab to visualize the zonotope. The second line computes
the measures of interest on the zonotope generate by external or boundary vectors.
The third and forth lines compute the measures of interest on the zonotope
generate by normalized vectors.
Elasticities are automatically printed to file isoquant_0.000000.csv. Note
however, that since they are computed applying smoothing techniques, their
estimates are much rough in this example with only 10 firms.

4. Plots with gnuplot

The code to perform plots can be downloaded here

5. Zon(n)ohedron

The program zonnohedron allows to perform the analysis in higher
dimensions, hence the extra 'n'. Zonnohedron requires the library Eigen
which can be downloaded here.
The user must provide data as standard input and specify the number of
columns (dimensions) of such file. By default the last column is output.