-
Notifications
You must be signed in to change notification settings - Fork 1
/
draft.tex
764 lines (679 loc) · 48.5 KB
/
draft.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
\documentclass[a4paper]{article}\usepackage[]{graphicx}\usepackage[]{color}
%% maxwidth is the original width if it is less than linewidth
%% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
\ifdim\Gin@nat@width>\linewidth
\linewidth
\else
\Gin@nat@width
\fi
}
\makeatother
\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
\usepackage{framed}
\makeatletter
\newenvironment{kframe}{%
\def\at@end@of@kframe{}%
\ifinner\ifhmode%
\def\at@end@of@kframe{\end{minipage}}%
\begin{minipage}{\columnwidth}%
\fi\fi%
\def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
\colorbox{shadecolor}{##1}\hskip-\fboxsep
% There is no \\@totalrightmargin, so:
\hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
\MakeFramed {\advance\hsize-\width
\@totalleftmargin\z@ \linewidth\hsize
\@setminipage}}%
{\par\unskip\endMakeFramed%
\at@end@of@kframe}
\makeatother
\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX
\usepackage{alltt}
\usepackage{iftex}
\ifPDFTeX
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\else
\ifXeTeX
\usepackage{xltxtra}
\else
\usepackage{luatextra}
\fi
\defaultfontfeatures{Ligatures=TeX}
\fi
\usepackage{blindtext}
\usepackage{rotating}
\usepackage{adjustbox}
\usepackage{mathtools}
\usepackage{threeparttable}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{changepage}
\usepackage{verbatim}
\usepackage{epigraph}
\usepackage{verbatim}
\usepackage{lscape}
\usepackage{pbox}
\usepackage{array}
\usepackage[natbib, authordate, backend=biber]{biblatex-chicago}
\usepackage[hidelinks]{hyperref}
\usepackage{cleveref}
\newcolumntype{R}[2]{
>{\adjustbox{angle=#1,lap=\width-(#2)}\bgroup}
l
<{\egroup}
}
\newcommand*\rot{\multicolumn{1}{R{45}{1em}}}
\newcommand*\rotnt{\multicolumn{1}{R{90}{1em}}}
\addbibresource{bibliography.bib}
\title{decompr: GVC decomposition in R}
\author{Bastiaan Quast and Victor Kummritz}
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\begin{document}
\maketitle
\vspace{\stretch{1}}
\abstract{Global Value Chains have become a central unit of analysis in research on international trade.
However, the complex matrix transformations at the basis of most Value Chain indicators still constitute a significant entry barrier to
the field.
The R package decompr solves this problem by implementing the algorithms for the analysis of Global Value Chains as R procedures, thereby simplifying the decomposition process.
Two methods for gross export flow decomposition using Inter-Country Input-Output tables are provided.
The first method concerns a decomposition based on the classical \textcite{wale36} insight.
It derives the value added origins of an industry's exports by source country and source industry, using easily vailable gross trade data.
The second method is the Wang-Wei-Zhu algorithm which splits bilateral gross exports into 16 value added components.
These components can broadly be divided into domestic and foreign value added in exports.
Using the results of the two decompositions, decompr provides a set of Global Value Chain indicators, such as the now standard Vertical Specialisation ratio.
This article summarises the methodology of the algorithms, describes the format of the input and output data,
and exemplifies the usefulness of the two methods on the basis of a simple example data set.}
\pagebreak
\section{Introduction}
Global Value Chains (GVCs) refer to the quickly expanding internationalization of production networks.
Most goods we use nowadays consist of parts that are sourced from different corners of the planet
and are assembled across different continents. A popular example of this development is the iPhone,
which uses inputs from at least five countries (USA, China, Germany, Taiwan, South Korea) and is assembled in two (USA and China).
This has made GVCs a central topic in research on trade and development policy.
Both policy makers and academia increasingly value the growth opportunities GVCs offer to global trade and,
especially, to developing countries.
However, analysing this phenomenon empirically requires complex matrix manipulations,
since the relevant data is only available in the form of gross flows.
The decompr package enables researchers with little background in matrix algebra and linear programming to easily derive standard GVC indicators for statistical analysis.
The package uses Inter-Country Input-Output tables (ICIOs), such as those published by the OECD and WTO (TiVA), % CITE!!
the World Input Output Database \parencite{timmer2012world}, or national statistics bureaus, as input.
These tables state supply and demand relationships in gross terms between industries within and across countries.
For instance, let us look at the example of the leather used in German manufactured car seats.
The ICIOs quantify the value of inputs that the Turkish leather and textiles industry
supplies to the German transport equipment industry. The problem of these tables measuring gross trade flows,
is that they do not reveal how much of the value was added in the supplying industry,
and how much of the value was added in previous stages of production, performed by other industries or even countries.
The Leontief decomposition of gross trade flows solves this problem by reallocating the value of intermediate goods used by industries to the original producers.
In our example, the use of Argentinian agricultural produce (raw hides) is subtracted from the Turkish leather industry and added to the Argentinian agricultural industry.
The Wang-Wei-Zhu (henceforth WWZ) decomposition goes a step further by not only revealing the source of the value added,
but also breaking down exports into different categories, according to final usage and destination.
It implements the theoretical work of \textcite{wang2014quantifying}.
The main categories in this framework are listed below.
\begin{enumerate}
\item domestic value added in exports
\item foreign value added in exports
\item pure double counted terms
\end{enumerate}
\subsection{Package Details}
The decompr package implements the algorithms for these decompositions as R procedures and provides example data sets.
The R procedures are implemented as functions, the included functions are listed below.
\begin{itemize}
\item \verb!load_tables_vectors!; transforms the input objects to an object used for the decompositions (class: decompr)
\item \verb!leontief!; takes a decompr object and applies the Leontief decomposition
\item \verb!wwz!; takes a decompr object and applies the Wang-Wei-Zhu decomposition
\item \verb!vertical_specialisation!; takes a decompr object and returns a measure of vertical specialisation (also works with \verb!vertical_specialization!)
\item \verb!leontief_output!; takes a decompr object and applies the Leontief decomposition using final output
\item \verb!decomp!; a wrapper function which integrates the use of \verb!load_tables_vectors! with the various decompositions, using an argument \textit{method} to specify the desired decomposition (default \verb!leontief!)
\end{itemize}
For legacy purposes, several depracated functions / methods are available under their original names.
In addition to this, two example data sets are included.
\begin{itemize}
\item \textit{World Input-Output Database} \parencite{timmer2012world}
\item \textit{Leather}; a fictional three-country, three-sector data set
\end{itemize}
Trade flow analysis often involves studying the development of a certain variable (set) over time, thus taking the panel form.
However, at the decomposition level, the panel dimension is essentially a repeated cross-section.
Therefore, as a design decision, the time dimension is not implemented in the package itself.
Instead, we provide examples of how this repetition can be implemented using a \verb!for-loop!.
\Cref{sec:data} introduces the data as it is used by the package as well as two example data sets,
after which \cref{sec:leontief,sec:wwz} summarise the theoretical derivations for the two decompositions, and show how these can be performed in R using decompr.
We conclude with a discussion of potential uses and further developments of GVC research.
\section{Data}
\label{sec:data}
Two data sets are included in the package, one real world data set and one minimal data set for demonstration purposes.
The former is the WIOD regional Inter-Country Input Output tables for the year 2011 \parencite{timmer2012world}.
The latter is a fictional 3-country 3-sector data set, which we will use throughout this article to demonstrate the usage and advantages of the decompr package.
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# load the package}
\hlkwd{library}\hlstd{(decompr)}
\end{alltt}
\end{kframe}
\end{knitrout}
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# load the data}
\hlkwd{data}\hlstd{(leather)}
\hlcom{# list the objects in the data set}
\hlkwd{ls}\hlstd{()}
\end{alltt}
\begin{verbatim}
## [1] "countries" "final" "industries" "inter" "out"
\end{verbatim}
\end{kframe}
\end{knitrout}
This data is set up in order to illustrate the benefits of the decompositions.
We do this by following the flows of intermediate goods through a fictional GVC and by showing how the readily available gross trade flows differ from the decomposed value added flows.
To this end, we construct the elements of the input-output tables such that we have two countries and two industries that focus on upstream tasks,
which means they focus on supplying other industries,
and one country and industry that is specialized in downstream tasks, i.e.~it serves mainly final demand.
In our example the upstream industries are Agriculture and Textiles while the downstream industry is Transport Equipment.
Similarly, Argentina and Turkey represent upstream countries with Germany being located downstream within this specific value chain (see \cref{tab:leather}).
\begin{sidewaystable}
\scriptsize
\caption{Example Input-Output Table: Leather}
\label{tab:leather}
\begin{tabular}{llrrrrrrrrrrrrrr}
\hline
& & \multicolumn{3}{c}{Argentina} & \multicolumn{3}{c}{Turkey} & \multicolumn{3}{c}{Germany} & \multicolumn{3}{c}{Final Demand} & Output \\
\hline
Country & Industry & \rotnt{\pbox{4cm}{Agriculture}} & \rotnt{\pbox{4cm}{Textile and\\ Leather}} & \rotnt{\pbox{4cm}{Transport\\ Equipment}} & \rotnt{\pbox{4cm}{Agriculture}} & \rotnt{\pbox{4cm}{Textile and\\ Leather}} & \rotnt{\pbox{4cm}{Transport\\ Equipment}} & \rotnt{\pbox{4cm}{Agriculture}} & \rotnt{\pbox{4cm}{Textile and\\ Leather}} & \rotnt{\pbox{4cm}{Transport\\ Equipment}} & \rotnt{Argentina} & \rotnt{Turkey} & \rotnt{Germany} \\
\hline
Argentina & Agriculture & 16.1 & 5.1 & 1.8 & 3.2 & 4.3 & 0.4 & 3.1 & 2.8 & 4.9 & 21.5 & 6.1 & 8.4 & 77.7 \\
Argentina & Textile.and.Leather & 2.4 & 8.0 & 3.2 & 0.1 & 3.2 & 1.6 & 1.2 & 3.9 & 11.5 & 16.2 & 1.9 & 5.1 & 58.3 \\
Argentina & Transport.Equipment & 0.9 & 0.5 & 4.0 & 0.0 & 0.1 & 0.3 & 0.0 & 0.4 & 0.5 & 11 & 0.5 & 0.8 & 19.0 \\
Turkey & Agriculture & 1.1 & 1.9 & 0.2 & 18.0 & 13.2 & 6.1 & 9.0 & 3.1 & 8.9 & 7.5 & 29.5 & 14.2 & 112.7 \\
Turkey & Textile.and.Leather & 0.3 & 2.8 & 0.1 & 6.1 & 28.1 & 6.3 & 2.1 & 2.5 & 25.6 & 8.9 & 24.9 & 16.9 & 124.6 \\
Turkey & Transport.Equipment & 0.0 & 0.1 & 0.3 & 4.1 & 3.2 & 8.9 & 0.2 & 0.0 & 1.8 & 1.2 & 18.5 & 4.9 & 43.2 \\
Germany & Agriculture & 1.2 & 4.2 & 0.3 & 4.1 & 1.2 & 0.6 & 29.0 & 19.5 & 17.9 & 9.2 & 17.9 & 51.2 & 156.3 \\
Germany & Textile.and.Leather & 1.3 & 1.1 & 0.0 & 3.2 & 4.8 & 2.6 & 5.1 & 29.1 & 24.1 & 7.9 & 10.1 & 38.5 & 127.8 \\
Germany & Transport.Equipment & 2.1 & 1.4 & 3.0 & 4.1 & 3.1 & 3.9 & 11.3 & 8.1 & 51.3 & 25.1 & 35.2 & 68.4 & 217.0 \\
\hline
\end{tabular}
\end{sidewaystable}
The first step of the analytical process is to load the input object and create a decompr class object,
which contains the data structures for the decompositions.
This step is not needed when using the \verb!decomp! wrapper function but more on this later.
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# create the decompr object}
\hlstd{decompr_object} \hlkwb{<-} \hlkwd{load_tables_vectors}\hlstd{(} \hlkwc{x} \hlstd{= inter,}
\hlkwc{y} \hlstd{= final,}
\hlkwc{k} \hlstd{= countries,}
\hlkwc{i} \hlstd{= industries,}
\hlkwc{o} \hlstd{= out )}
\hlcom{# inspect the content of the decompr object}
\hlkwd{ls}\hlstd{(decompr_object)}
\end{alltt}
\begin{verbatim}
## [1] "A" "Ad" "Am" "B" "Bd"
## [6] "bigrownam" "Bm" "E" "Efd" "Eint"
## [11] "ESR" "Exp" "G" "GN" "i"
## [16] "k" "L" "N" "rownam" "Vc"
## [21] "Vhat" "X" "Y" "Yd" "Ym"
## [26] "z" "z01" "z02"
\end{verbatim}
\end{kframe}
\end{knitrout}
As can be seen above, a decompr class object is in fact a list containing thirty different objects.
For example, \textit{Eint} is an object that collects the intermediate goods exports of the industries,
while \textit{Y} refers to the final demand that the industries supply.
Depending on the choice of the decomposition, all or some of these objects are used.
\section{Leontief decomposition}
\label{sec:leontief}
Let us now turn to the algorithms, starting with the Leontief decomposition.
We shortly describe the theoretical derivation of the method to expose the internal steps of the decompr package.
Afterwards, we turn to the technical implementation and, finally, we describe the output.
\subsection{Theoretical derivation}
The tools to derive the source decomposition date back to \citet{wale36} who showed that, with a set of simple calculations,
national Input-Output tables based on gross terms give the true value added flows between industries.
The idea behind this insight is that the production of industry \textit{i}'s output requires inputs of other industries
and \textit{i}'s own value added.
The latter is the direct contribution of \textit{i}'s output to domestic value added.
The former refers to the first round of \textit{i}'s indirect contribution to domestic value added since the input from
other industries that \textit{i} requires for its own production triggers the creation of value added in the supplying
industries.
As supplying industries usually depend on inputs from other industries, this sets in motion a second round
of indirect value added creation in the supplying industries of the suppliers, which is also caused by \textit{i}'s production.
This goes on until value added is traced back to the original suppliers and can mathematically be expressed as
\begin{equation}
VB = V + VA + VAA + VAAA + ... = V (I+A+A^{2}+A^{3}+...),
\end{equation}
which, as an infinite geometric series with the elements of $A<1$, simplifies to
\begin{equation}
VB = V (I-A)^{-1},
\end{equation}
where \textit{V} is a $N x N$ matrix with the diagonal representing the direct value added contribution of $N$ industries,
\textit{A} is the Input-Output coefficient matrix with dimension $N x N$, i.e. it gives the direct input flows between
industries required for 1\$ of output, and $B = (I-A)^{-1}$ is the so called Leontief inverse.
\textit{VB} gives thus a $N x N$ matrix of so called value added multipliers, which denote the amount of value added that the production of an industry's 1\$ of output or exports brings about in all other industries.
Looking from the perspective of the supplying industries, the matrix gives the value added that they contribute to the using industry's production.
If we multiply it with a $N x N$ matrix whose diagonal specifies each industry's total output or exports, we get value added origins as absolute values instead of shares.
The application of the Leontief insight to ICIOs as opposed to national Input-Output tables for our Leontief decomposition is straightforward.
\textit{V} refers now to a vector of direct value added contributions of all industries across the different countries.
Its dimension is correspondingly $1 x GN$, where $G$ is the number of countries.
\textit{A} is now of dimension $GN x GN$ and gives the industry flows including cross border relationships.
Since we are interested in the value added origins of exports we multiply these two matrices with a $GN x GN$ matrix whose diagonal we fill with each industry's exports, $E$,
such that the basic equation behind the source decomposition is given by $V(I-A)^{-1}E$.
\footnote{When using the leontief\_output function, the value added multiplier is instead multiplied with each industry's output.}
In a simple example with two countries (\textit{k} and \textit{l}) and industries (\textit{i} and \textit{j}) we can zoom in to see the matrices' content:
\begin{align}
\begin{split}
V (I- A )^{-1} E
&=
\begin{pmatrix}
v_{k}^{i}& 0& 0& 0\\
0& v_{k}^{j}& 0& 0\\
0& 0& v_{l}^{i}& 0\\
0& 0& 0& v_{l}^{j}
\end{pmatrix}
*
\begin{pmatrix}
b_{kk}^{ii}& b_{kk}^{ij}& b_{kl}^{ii}& b_{kl}^{ij}\\
b_{kk}^{ji}& b_{kk}^{jj}& b_{kl}^{ji}& b_{kl}^{jj}\\
b_{lk}^{ii}& b_{lk}^{ij}& b_{ll}^{ii}& b_{ll}^{ij}\\
b_{lk}^{ji}& b_{lk}^{jj}& b_{ll}^{ji}& b_{ll}^{jj}
\end{pmatrix}\\
&*
\begin{pmatrix}
e_{k}^{i}& 0& 0& 0\\
0& e_{k}^{j}& 0& 0\\
0& 0& e_{l}^{i}& 0\\
0& 0& 0& e_{l}^{j}
\end{pmatrix}\\
&=
\begin{pmatrix}
v_{k}^{i}b_{kk}^{ii}e_{k}^{i}& v_{k}^{i} b_{kk}^{ij}e_{k}^{j}& v_{k}^{i}b_{kl}^{ii}e_{l}^{i}& v_{k}^{i}b_{kl}^{ij}e_{l}^{j}\\
v_{k}^{j}b_{kk}^{ji}e_{k}^{i}& v_{k}^{j}b_{kk}^{jj}e_{k}^{j}& v_{k}^{j}b_{kl}^{ji}e_{l}^{i}& v_{k}^{j}b_{kl}^{jj}e_{l}^{j}\\
v_{l}^{i}b_{lk}^{ii}e_{k}^{i}& v_{l}^{i}b_{lk}^{ij}e_{k}^{j}& v_{l}^{i}b_{ll}^{ii}e_{l}^{i}& v_{l}^{i}b_{ll}^{ij}e_{l}^{j}\\
v_{l}^{j}b_{lk}^{ji}e_{k}^{i}& v_{l}^{j}b_{lk}^{jj}e_{k}^{j}& v_{l}^{j}b_{ll}^{ji}e_{l}^{i}& v_{l}^{j}b_{ll}^{jj}e_{l}^{j}
\end{pmatrix}\\
&=
\begin{pmatrix}
vae_{kk}^{ii}& vae_{kk}^{ij}& vae_{kl}^{ii}& vae_{kl}^{ij}\\
vae_{kk}^{ji}& vae_{kk}^{jj}& vae_{kl}^{ji}& vae_{kl}^{jj}\\
vae_{lk}^{ii}& vae_{lk}^{ij}& vae_{ll}^{ii}& vae_{ll}^{ij}\\
vae_{lk}^{ji}& vae_{lk}^{jj}& vae_{ll}^{ji}& vae_{ll}^{jj}
\end{pmatrix}
\end{split}
\end{align}
\begin{align*}
&v_{c}^{s} = \frac{va_{c}^{s}}{y_{c}^{s}} = 1 - a_{kc}^{is} - a_{kc}^{js} - a_{lc}^{js} - a_{lc}^{is} \hspace{2cm} (c \in k,l \hspace{.5cm} s \in i,j),\\
&\begin{pmatrix}
b_{kk}^{ii}& b_{kk}^{ij}& b_{kl}^{ii}& b_{kl}^{ij}\\
b_{kk}^{ji}& b_{kk}^{jj}& b_{kl}^{ji}& b_{kl}^{jj}\\
b_{lk}^{ii}& b_{lk}^{ij}& b_{ll}^{ii}& b_{ll}^{ij}\\
b_{lk}^{ji}& b_{lk}^{jj}& b_{ll}^{ji}& b_{ll}^{jj}
\end{pmatrix}
=
\begin{pmatrix}
1-a_{kk}^{ii}& -a_{kk}^{ij}& -a_{kl}^{ii}& -a_{kl}^{ij}\\
-a_{kk}^{ji}& 1-a_{kk}^{jj}& -a_{kl}^{ji}& -a_{kl}^{jj}\\
-a_{lk}^{ii}& -a_{lk}^{ij}& 1-a_{ll}^{ii}& -a_{ll}^{ij}\\
-a_{lk}^{ji}& -a_{lk}^{jj}& -a_{ll}^{ji}& 1-a_{ll}^{jj}
\end{pmatrix}^{-1},
\end{align*}
and
\begin{equation*}
a_{cf}^{su} = \frac{inp_{cf}^{su}}{y_{f}^{u}} \hspace{2cm} (c,f \in k,l \hspace{.5cm} s,u \in i,j),
\end{equation*}
where \(v_{s}^{c}\) gives the share of industry \emph{s}'s value added, \(va_{c}^{s},\) in output, \(y_{s}^{c}\), and \(e_{k}^{i}\) indicates gross exports. Finally, \(a_{su}^{cf}\) denotes the share of inputs, \(inp_{su}^{cf}\), in output.
The elements of the $V(I-A)^{-1}E$ or $vae$ matrix are our estimates for the country-industry level value added
origins of each country-industry's exports.
decompr implements this algorithm into R to automate the process of deriving the matrix.
Equipped with it, researchers can calculate standard GVC indicators.
Examples include \textcite{dahuetal01}'s Vertical Specialisation ratio at the industry-level using the \verb!vertical_specialisation! function,
which sums for each country and industry across the value added of all foreign countries and industries,
and \textcite{rojoguno12}'s so-called VAX ratio.
Alternatively, the four dimensions of the matrix (source country, source industry, using country, using industry) allow for industry-level gravity-type estimations of value added trade flows.
\subsection{Implentation}
As described, in \cref{sec:data}, the first step of our analytical process is to construct a decompr object using the \verb!load_tables_vectors! function. After this, we can use the \verb!leontief! function to apply to Leontief decomposition.
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{lt} \hlkwb{<-} \hlkwd{leontief}\hlstd{( decompr_object )}
\end{alltt}
\end{kframe}
\end{knitrout}
In addition, a wrapper function called \verb!decomp! is provided which integrates both elements of the workflow into a single function.
We recomended that the atomic functions be used for large data sets, however, for small data sets this is an easy way to derive the results immediatly.
The \verb!decomp! function requires a method to be specified (see \verb!help("decomp")! for details), if none is provided, the function will default to \verb!leontief!.
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{lt2} \hlkwb{<-} \hlkwd{decomp}\hlstd{(} \hlkwc{x} \hlstd{= inter,}
\hlkwc{y} \hlstd{= final,}
\hlkwc{k} \hlstd{= countries,}
\hlkwc{i} \hlstd{= industries,}
\hlkwc{o} \hlstd{= out,}
\hlkwc{method} \hlstd{=} \hlstr{"leontief"} \hlstd{)}
\end{alltt}
\end{kframe}
\end{knitrout}
Note that the output produced by these two different processes is identical.
\subsection{Output}
We can now analyse the output of the Leontief decomposition, which consists of a $GNxGN$ matrix that gives for each country and industry the
value added origins of its exports by country and industry.
To this end, we look at the results of the Leontief decomposition for our example data set (\cref{tab:leon}).
In the first column we find the source countries and industries while the first row contains the using countries and industries.
The first element, $28.52$, thus gives the amount of value added that the Argentinian Agriculture industry has contributed to the exports of the Argentinian Agriculture industry.
Similarly, the last element of this row, $4.12$, gives the amount of value added that the Argentinian Agriculture industry has contributed
to the exports of the German Transport Equipment industry.
\begin{sidewaystable}
\scriptsize
\caption{Non-decomposed Values}
\label{tab:noleon}
\begin{tabular}{lrrrrrrrrr}
\hline
& Argentina. & Argentina. & Argentina. & Turkey. & Turkey. & Turkey. & Germany. & Germany. & Germany.\\
& Agriculture & Textile.and. & Transport. & Agriculture & Textile.and. & Transport. & Agriculture & Textile.and. & Transport.\\
& & Leather & Equipment & & Leather & Equipment & & Leather & Equipment\\
\hline
Argentina.Agriculture & 6.88 & 2.49 & 0.25 & 1.30 & 2.04 & 0.08 & 0.77 & 0.68 & 1.76 \\
Argentina.Textile.and.Leather & 1.03 & 3.91 & 0.44 & 0.04 & 1.52 & 0.31 & 0.30 & 0.95 & 4.13 \\
Argentina.Transport.Equipment & 0.38 & 0.24 & 0.55 & 0.00 & 0.05 & 0.06 & 0.00 & 0.10 & 0.18 \\
Turkey.Agriculture & 0.47 & 0.93 & 0.03 & 7.33 & 6.27 & 1.20 & 2.23 & 0.75 & 3.19 \\
Turkey.Textile.and.Leather & 0.13 & 1.37 & 0.01 & 2.48 & 13.35 & 1.24 & 0.52 & 0.61 & 9.19 \\
Turkey.Transport.Equipment & 0.00 & 0.05 & 0.04 & 1.67 & 1.52 & 1.75 & 0.05 & 0.00 & 0.65 \\
Germany.Agriculture & 0.51 & 2.05 & 0.04 & 1.67 & 0.57 & 0.12 & 7.18 & 4.73 & 6.43 \\
Germany.Textile.and.Leather & 0.56 & 0.54 & 0.00 & 1.30 & 2.28 & 0.51 & 1.26 & 7.06 & 8.65 \\
Germany.Transport.Equipment & 0.90 & 0.68 & 0.41 & 1.67 & 1.47 & 0.77 & 2.80 & 1.96 & 18.42 \\
\hline
\end{tabular}
\bigskip \bigskip \bigskip
\caption{Leontief Decomposition}
\label{tab:leon}
\begin{tabular}{lrrrrrrrrr}
\hline
& Argentina. & Argentina. & Argentina. & Turkey. & Turkey. & Turkey. & Germany. & Germany. & Germany.\\
& Agriculture & Textile.and. & Transport. & Agriculture & Textile.and. & Transport. & Agriculture & Textile.and. & Transport.\\
& & Leather & Equipment & & Leather & Equipment & & Leather & Equipment\\
\hline
Argentina.Agriculture & 28.52 & 2.79 & 0.36 & 1.81 & 3.12 & 0.36 & 1.24 & 1.30 & 4.12 \\
Argentina.Textile.and.Leather & 1.06 & 19.12 & 0.42 & 0.48 & 1.83 & 0.43 & 0.59 & 1.15 & 4.75 \\
Argentina.Transport.Equipment & 0.21 & 0.14 & 1.06 & 0.03 & 0.08 & 0.04 & 0.02 & 0.07 & 0.19 \\
Turkey.Agriculture & 0.72 & 1.34 & 0.12 & 34.93 & 7.00 & 1.48 & 2.55 & 1.52 & 6.18 \\
Turkey.Textile.and.Leather & 0.41 & 1.39 & 0.12 & 2.69 & 40.17 & 1.32 & 1.11 & 1.15 & 9.51 \\
Turkey.Transport.Equipment & 0.03 & 0.09 & 0.03 & 0.81 & 0.91 & 3.16 & 0.12 & 0.07 & 0.65 \\
Germany.Agriculture & 0.93 & 2.25 & 0.16 & 2.31 & 2.06 & 0.51 & 29.88 & 5.25 & 9.60 \\
Germany.Textile.and.Leather & 0.65 & 0.73 & 0.08 & 1.54 & 2.55 & 0.63 & 1.46 & 18.96 & 8.16 \\
Germany.Transport.Equipment & 0.67 & 0.65 & 0.26 & 1.29 & 1.49 & 0.57 & 1.73 & 1.51 & 34.74 \\
\hline
\end{tabular}
\end{sidewaystable}
A key advantage of the decomposition becomes clear when we compare the decomposed values with the intermediate trade
values of the non-decomposed IO table when multiplied with the exports over output ratio to create
comparability (\cref{tab:noleon}).
We see for instance that Argentina's Agriculture industry contributes significantly more value added to the German Transport Equipment industry than suggested by the non-decomposed IO table.
The reason is that Argentina's Agriculture industry is an important supplier to Turkey's Textile and Leather industry which is in turn an important supplier for the German Transport Equipment industry.
The decomposition thus allows us to see how the value added flows along this Global Value Chain.
We can also take look at specific industries.
For instance, we find that the non-decomposed values of the Transport Equipment are for many elements larger than the value added elements while the opposite holds for Agriculture.
This emphasises the fact that Transport Equipment is a downstream industry that produces mostly final goods.
Agriculture on the other hand qualifies as an upstream industry that produces also many intermediate goods so that its value added in other industries is typically large.
Finally let's consider the countries of our specific example.
We see that Germany has more instances in which the non-decomposed values are above the value added flows than Argentina and Turkey combined.
Along the lines of the industry analysis, this shows that Germany focuses within this GVC on downstream tasks producing mostly final goods that contain value added from countries located more upstream.
In our example these are Turkey and Argentina.
\section{Wang-Wei-Zhu decomposition}
\label{sec:wwz}
The Wang-Wei-Zhu decomposition builds upon the Leontief insight but uses, in addition, further valuable information provided in ICIOs.
More specifically, the Leontief decomposition traces the value added back to where it originates but ICIOs also contain data on how the value added is subsequently used.
This information is extracted by the Wang-Wei-Zhu decomposition,
which thereby allows a much more detailed look at the structures of international production networks and the respective positions of countries and industries within them.
\subsection{Theoretical derivation}
The derivation of the Wang-Wei-Zhu decomposition is significantly more technical than the source decomposition since it splits gross exports up more finely.
This is why we present here only the final equation for a two country one industry model (equation 22 in WWZ) and refer the interested reader to the original paper by \textcite{wang2014quantifying}.
The key idea is to use the Leontief insight and extend it using additional information from ICIOs on the final usage and destination of the exports (e.g. re-imported vs. absorbed abroad).
\begin{align}
\label{eq:wwz}
\begin{split}
E^{kl}
= &\left(V^k B^{kk} \right)^T * F^{kl}
+ \left(V^k L^{kk} \right)^T * \left(A^{kl} B^{ll} F^{ll} \right)\\
+& \left(V^k L^{kk} \right)^T * (A^{kl} \sum_{t \neq k,l}^G B^{lt} F^{tt} )
+ \left(V^k L^{kk} \right)^T * (A^{kl} B^{ll} \sum_{t \neq k,l}^G F^{lt} )\\
+& \left(V^k L^{kk} \right)^T * (A^{kl} \sum_{t \neq k}^G \sum_{l,u \neq k,t}^G B^{lt} F^{tu} )
+ \left(V^k L^{kk} \right)^T * \left(A^{kl} B^{ll} F^{lk} \right)\\
+& \left(V^k L^{kk} \right)^T * (A^{kl} \sum_{t \neq k,l}^G B^{lt} F^{tk} )
+ \left(V^k L^{kk} \right)^T * \left(A^{kl} B^{lk} F^{kk} \right) \\
+& \left(V^k L^{kk} \right)^T * (A^{kl} \sum_{t \neq k}^G B^{lk} F^{kt} )
+ \left(V^k B^{kk} - V^k L^{kk} \right)^T * \left(A^{kl} X^{l} \right)\\
+& \left(V^l B^{lk} \right)^T * F^{kl}
+ \left(V^l B^{lk} \right)^T * \left(A^{kl} L^{ll} F^{ll} \right)
+ \left(V^l B^{lk} \right)^T \\
*& \left(A^{kl} L^{ll} E^{l*} \right) + (\sum_{t \neq k,l}^G V^{t} B^{tk} )^{T} * F^{kl}
+ (\sum_{t \neq k,l}^G V^{t} B^{tk} )^{T}\\
*& \left(A^{kl} L^{ll} F^{ll} \right) + (\sum_{t \neq k,l}^G V^{t} B^{tk} )^{T} * \left(A^{kl} L^{ll} E^{l*} \right) ,
\end{split}
\end{align}
where $F^{kl}$ is the final demand in $l$ for goods of $k$,
$L^{ll}$ refers to the national Leontief inverse as opposed to the Inter-Country inverse $B$,
and \textit{T} indicates a matrix transpose operation.
As can be seen from equation (\ref{eq:wwz}),
the Wang-Wei-Zhu decomposition splits gross exports into 16 terms with three main categories given by domestic value added in exports (\textit{DViX\_B}), foreign value added in exports (\textit{FVA}), and purely double counted terms (\textit{PDC}).
The main categories are further divided according to their final destination so that the final decomposition is given by:
\begin{itemize}
\item Domestic value added absorbed abroad (\textit{VAX\_G}, T1-5)
\begin{itemize}
\item Domestic value added in final exports (\textit{DVA\_FIN}, T1)
\item Domestic value added in intermediate exports
\begin{itemize}
\item Domestic value added in intermediate exports absorbed by direct importers (\textit{DVA\_INT}, T2)
\item Domestic value added in intermediate exports re-exported to third countries (\textit{DVA\_INTrex}, T3-5)
\begin{itemize}
\item Domestic value added in intermediate exports re-exported to third countries as intermediate goods to produce domestic final goods (\textit{DVA\_INTrexI1}, T3)
\item Domestic value added in intermediate exports re-exported to third countries as final goods (\textit{DVA\_INTrexF}, T4)
\item Domestic value added in intermediate exports re-exported to third countries as intermediate goods to produce exports (\textit{DVA\_INTrexI2}, T5)
\end{itemize}
\end{itemize}
\end{itemize}
\item Domestic value added returning home (\textit{RDV\_B}, T6-8)
\begin{itemize}
\item Domestic value added returning home as final goods (\textit{RDV\_FIN}, T6)
\item Domestic value added returning home as final goods through third countries (\textit{RDV\_FIN2}, T7)
\item Domestic value added returning home as intermediate goods (\textit{RDV\_INT}, T8)
\end{itemize}
\item Foreign value added (\textit{FVA}, T11-12/14-15 )
\begin{itemize}
\item Foreign value added in final good exports (\textit{FVA\_FIN}, T11/14)
\begin{itemize}
\item Foreign value added in final good exports sourced from direct importer (\textit{MVA\_FIN}, T11)
\item Foreign value added in final good exports sourced from other countries (\textit{OVA\_FIN}, T14)
\end{itemize}
\item Foreign value added in intermediate good exports (\textit{FVA\_INT}, T12/15)
\begin{itemize}
\item Foreign value added in intermediate good exports sourced from direct importer (\textit{MVA\_INT}, T12)
\item Foreign value added in intermediate good exports sourced from other countries(\textit{OVA\_INT}, T15)
\end{itemize}
\end{itemize}
\item Pure double counting (\textit{PDC}, T9-10/13/16)
\begin{itemize}
\item Pure double counting from domestic source (\textit{DDC}, T9-10)
\begin{itemize}
\item Due to final goods exports production (\textit{DDF}, T9)
\item Due to intermediate goods exports production (\textit{DDI}, T10)
\end{itemize}
\item Pure double counting from foreign source (\textit{FDC}, T13/16)
\begin{itemize}
\item Due to direct importer exports production (\textit{FDF}, T13)
\item Due to other countries' exports production (\textit{FDI}, T16)
\end{itemize}
\end{itemize}
\end{itemize}
The higher resolution of the WWZ decomposition comes at the cost of a lower dimension (source country, using country, using industry) since the current, highly aggregated, ICIOs render a four-dimensional decomposition unfeasible.
This means that the two methods are complementary and imply a trade-off between detail and disaggregation.
\subsection{Implementation}
As with the \verb!leontief! function,
the \verb!wwz! function also takes a decompr class object as its input,
the procedure for this is described in \cref{sec:data}.
After having created this decompr object,
we can apply the Wang-Wei-Zhu decomposition using the \verb!wwz! function.
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{w} \hlkwb{<-} \hlkwd{wwz}\hlstd{(decompr_object)}
\end{alltt}
\end{kframe}
\end{knitrout}
Furthermore, it is also possible to derive the results of the Wang-Wei-Zhu decomposition directly, using the \verb!decomp! function.
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{w2} \hlkwb{<-} \hlkwd{decomp}\hlstd{(} \hlkwc{x} \hlstd{= inter,}
\hlkwc{y} \hlstd{= final,}
\hlkwc{k} \hlstd{= countries,}
\hlkwc{i} \hlstd{= industries,}
\hlkwc{o} \hlstd{= out,}
\hlkwc{method} \hlstd{=} \hlstr{"wwz"} \hlstd{)}
\end{alltt}
\end{kframe}
\end{knitrout}
Both these processes will yield the same results.
\subsection{Output}
The output when using the WWZ algorithm is a matrix with dimensions $GNGx19$,
whereby 19 consists of the 16 objects the WWZ algorithm decomposes exports into, plus three checksums.
$GNG$ represents source country, source industry and using country whereas these terms are slightly ambiguous here due to the complex nature of the decomposition.
More specifically, the using country can also be the origin of the foreign value added in the exports of the source country to the using country (see for example T11 and T12).
Therefore we use the terms exporter, exporting industry, and direct importer instead.
This becomes much clearer when we take a look at specific examples.
\begin{sidewaystable}[htbp]\scriptsize
\centering
\caption{WWZ Decomposition}
\label{tab:wwz}
\begin{tabular}{lrrrrrrrrrrrrrrr}
\toprule
exporter.exportingind.importer & \rot{DVA\_FIN} & \rot{DVA\_INT} & \rot{DVA\_INTrexI1} & \rot{DVA\_INTrexF} & \rot{DVA\_INTrexI2} & \rot{RDV\_INT} & \rot{RDV\_FIN} & \rot{RDV\_FIN2} & \rot{OVA\_FIN} & \rot{MVA\_FIN} & \rot{OVA\_INT} & \rot{MVA\_INT} & \rot{DDC\_FIN} & \rot{DDC\_INT} & \rot{ODC} \\
\midrule
Argentina.Agriculture.Argentina & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Argentina.Agriculture.Turkey & 5.47 & 2.68 & 1.14 & 1.41 & 0.50 & 0.17 & 0.71 & 0.35 & 0.41 & 0.21 & 0.20 & 0.10 & 0.06 & 0.07 & 0.34 \\
Argentina.Agriculture.Germany & 7.54 & 5.11 & 0.41 & 2.07 & 0.18 & 0.24 & 1.41 & 0.08 & 0.30 & 0.57 & 0.19 & 0.37 & 0.09 & 0.10 & 0.18 \\
sub.TOTAL & 13.01 & 7.79 & 1.55 & 3.48 & 0.69 & 0.41 & 2.11 & 0.43 & 0.71 & 0.78 & 0.39 & 0.48 & 0.15 & 0.17 & 0.52 \\
Argentina.Textile.and.Leather.Argentina & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Argentina.Textile.and.Leather.Turkey & 1.47 & 1.61 & 0.52 & 0.74 & 0.24 & 0.08 & 0.33 & 0.17 & 0.24 & 0.19 & 0.26 & 0.20 & 0.03 & 0.08 & 0.36 \\
Argentina.Textile.and.Leather.Germany & 3.95 & 6.45 & 0.54 & 2.82 & 0.24 & 0.32 & 1.98 & 0.11 & 0.50 & 0.65 & 0.81 & 1.05 & 0.11 & 0.28 & 0.83 \\
sub.TOTAL & 5.42 & 8.06 & 1.06 & 3.56 & 0.48 & 0.40 & 2.32 & 0.27 & 0.75 & 0.84 & 1.07 & 1.25 & 0.13 & 0.37 & 1.19 \\
Argentina.Transport.Equipment.Argentina & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Argentina.Transport.Equipment.Turkey & 0.35 & 0.15 & 0.03 & 0.05 & 0.01 & 0.00 & 0.02 & 0.01 & 0.10 & 0.05 & 0.04 & 0.02 & 0.00 & 0.01 & 0.04 \\
Argentina.Transport.Equipment.Germany & 0.57 & 0.32 & 0.03 & 0.13 & 0.01 & 0.01 & 0.09 & 0.01 & 0.08 & 0.15 & 0.05 & 0.09 & 0.01 & 0.03 & 0.04 \\
sub.TOTAL & 0.92 & 0.47 & 0.05 & 0.18 & 0.02 & 0.02 & 0.11 & 0.01 & 0.18 & 0.20 & 0.09 & 0.11 & 0.01 & 0.04 & 0.08 \\
Turkey.Agriculture.Argentina & 6.28 & 1.12 & 0.42 & 0.32 & 0.13 & 0.15 & 0.17 & 0.18 & 0.84 & 0.38 & 0.15 & 0.07 & 0.11 & 0.07 & 0.21 \\
Turkey.Agriculture.Turkey & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Turkey.Agriculture.Germany & 11.89 & 9.19 & 0.44 & 2.46 & 0.10 & 0.69 & 3.74 & 0.06 & 0.72 & 1.59 & 0.55 & 1.22 & 0.45 & 0.44 & 0.51 \\
sub.TOTAL & 18.17 & 10.31 & 0.87 & 2.79 & 0.23 & 0.85 & 3.91 & 0.24 & 1.56 & 1.97 & 0.70 & 1.28 & 0.56 & 0.51 & 0.72 \\
Turkey.Textile.and.Leather.Argentina & 7.23 & 1.05 & 0.46 & 0.30 & 0.14 & 0.15 & 0.13 & 0.20 & 0.92 & 0.76 & 0.13 & 0.11 & 0.10 & 0.07 & 0.20 \\
Turkey.Textile.and.Leather.Turkey & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Turkey.Textile.and.Leather.Germany & 13.72 & 12.01 & 0.63 & 3.91 & 0.13 & 0.95 & 5.58 & 0.07 & 1.44 & 1.74 & 1.25 & 1.51 & 0.60 & 0.66 & 1.32 \\
sub.TOTAL & 20.95 & 13.05 & 1.09 & 4.20 & 0.27 & 1.10 & 5.71 & 0.28 & 2.35 & 2.50 & 1.38 & 1.62 & 0.70 & 0.72 & 1.51 \\
Turkey.Transport.Equipment.Argentina & 0.84 & 0.18 & 0.02 & 0.02 & 0.01 & 0.01 & 0.01 & 0.01 & 0.24 & 0.12 & 0.05 & 0.03 & 0.01 & 0.02 & 0.03 \\
Turkey.Transport.Equipment.Turkey & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Turkey.Transport.Equipment.Germany & 3.43 & 0.65 & 0.04 & 0.22 & 0.01 & 0.05 & 0.31 & 0.00 & 0.48 & 0.99 & 0.09 & 0.20 & 0.03 & 0.09 & 0.10 \\
sub.TOTAL & 4.27 & 0.83 & 0.06 & 0.24 & 0.01 & 0.06 & 0.32 & 0.01 & 0.72 & 1.11 & 0.15 & 0.22 & 0.04 & 0.11 & 0.13 \\
Germany.Agriculture.Argentina & 7.86 & 2.02 & 0.28 & 0.28 & 0.06 & 0.82 & 0.57 & 0.13 & 0.90 & 0.44 & 0.23 & 0.11 & 0.61 & 0.10 & 0.33 \\
Germany.Agriculture.Turkey & 15.29 & 2.06 & 0.12 & 0.48 & 0.02 & 0.74 & 0.97 & 0.03 & 0.86 & 1.75 & 0.11 & 0.23 & 0.53 & 0.10 & 0.17 \\
Germany.Agriculture.Germany & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
sub.TOTAL & 23.16 & 4.08 & 0.40 & 0.76 & 0.08 & 1.56 & 1.54 & 0.16 & 1.76 & 2.19 & 0.34 & 0.35 & 1.14 & 0.20 & 0.50 \\
Germany.Textile.and.Leather.Argentina & 6.55 & 0.79 & 0.12 & 0.15 & 0.03 & 0.31 & 0.26 & 0.06 & 0.70 & 0.65 & 0.08 & 0.08 & 0.22 & 0.05 & 0.13 \\
Germany.Textile.and.Leather.Turkey & 8.38 & 3.69 & 0.19 & 0.79 & 0.02 & 1.22 & 1.70 & 0.05 & 0.82 & 0.90 & 0.36 & 0.39 & 0.92 & 0.22 & 0.50 \\
Germany.Textile.and.Leather.Germany & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
sub.TOTAL & 14.93 & 4.48 & 0.31 & 0.94 & 0.05 & 1.53 & 1.96 & 0.10 & 1.53 & 1.54 & 0.45 & 0.47 & 1.15 & 0.27 & 0.63 \\
Germany.Transport.Equipment.Argentina & 16.92 & 2.37 & 0.18 & 0.26 & 0.04 & 0.44 & 0.43 & 0.08 & 5.26 & 2.92 & 0.78 & 0.43 & 0.31 & 0.26 & 0.59 \\
Germany.Transport.Equipment.Turkey & 23.72 & 3.27 & 0.15 & 0.61 & 0.02 & 0.91 & 1.37 & 0.04 & 4.10 & 7.38 & 0.59 & 1.06 & 0.67 & 0.45 & 0.71 \\
Germany.Transport.Equipment.Germany & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
sub.TOTAL & 40.64 & 5.64 & 0.33 & 0.87 & 0.06 & 1.34 & 1.80 & 0.12 & 9.36 & 10.30 & 1.36 & 1.49 & 0.99 & 0.71 & 1.29 \\
\bottomrule
\end{tabular}
\end{sidewaystable}
\Cref{tab:wwz} shows the results for the example data.
The first column lists exporter, exporting industry, and direct importer.
Note that the value added is domestic but not necessarily created in the exporting industry.
When exporter and importer are identical, the values are zero since there are no exports.
The first row lists the 16 components of bilateral exports at the sector level and three checksums.
The first eight components relate to domestic value added of the exporting country contained in the sectoral exports of the exporting industry to the direct importer.
For instance, the first non-zero element in \cref{tab:wwz} refers to $DVA\_FIN$, or domestic value added in final good exports.
It shows that there are 5.47 units of domestic value added in the exports of final goods from Argentina's Agriculture industry to Turkey.
In the same row the third term, \textit{DVA\_INTrexI1}, is slightly more complicated.
As mentioned above, it gives the amount of domestic Value added in intermediate exports re-exported to third countries as intermediate goods to produce domestic final goods.
In our example this means that there are 1.14 units of domestic value added in the intermediate exports of Argentina's Agriculture industry to Turkey,
that are re-exported by Turkey as intermediates to a third country which produces final goods with it.
Terms six to eight concern domestic value added that eventually returns home.
\textit{RDV\_FIN2} reveals for example that there are 0.35 units of domestic value added in the intermediate exports of Argentina's Agriculture industry to Turkey,
that Turkey re-exports as intermediates to Argentina for the latter's final good production.
The following four terms apply to foreign value added in exports and separate on the one hand between the origin of the foreign value added ($MVA$ vs $OVA$) and on the other hand between the type of export (intermediate vs final good).
$MVA$ describes hereby foreign value added sourced by the exporting country from the direct importer.
From the perspective of the latter, these terms are thus part of the $RDV$ (value added returning home) share.
$OVA$ in contrast sums over the foreign value added sourced from all other countries.
Going back to the example, this means that there are 0.21 units of Turkish value added in the final goods exports of Argentina's Agriculture industry to Turkey.
Terms 13 to 16 collect the double counting of gross trade statistics that occurs when goods cross borders multiple times.
$DDC$ captures double counting due to domestic value added,
which is further classified according to the type of the ultimate export (final vs intermediate good).
$MDC$ and $ODC$, on the other hand, capture double counting due to foreign value added from either the direct importer or other countries.
For the Argentina-Turkey case this implies, for instance, that there are 0.18 units of value added in the intermediate exports of Turkey to Argentina which are re-exported by Argentina's Agriculture industry to Turkey as intermediates and then again re-exported.
Since they would be part of $MVA$ twice, they are now counted once as double-counted term.
Finally, the three checksums give total exports, total final goods exports, and total intermediate exports.
The difference between the first and the latter two should be zero.
One interesting application of this decomposition for trade and development uses changes over time in $FVA\_FIN$ and $FVA\_INT$.
When low-wage developing countries enter GVCs, they tend to specialize mainly in assembly but try to gradually move up within the value chain.
To illustrate this, we can reuse the example of the iPhone.
Most of the value added in the device stems from US design and Japanese technology but it is ultimately assembled in China.
This means for China that when it enters this GVC, its $FVA\_FIN$ starts to increase since it imports a lot of foreign value added, assembles it, and exports a final good: the iPhone.
However, assembly itself does not contain a lot of value added so that the benefit of China initially is small.
When its technology improves due to the interaction with Japan and the USA, it might be able to produce actual parts of the phone,
which contain more value added.
Eventually it might even be able to outsource assembly to a cheaper country.
This would imply that it seizes a larger share of the value added, something commonly referred to as upgrading or moving up within the value chain.
In terms of the WWZ decomposition, we would then observe that China's $FVA\_FIN$ first goes up and then starts to decline with
a simultaneous increase in $FVA\_INT$.
\section{Conclusion}
\label{sec:conclusion}
GVCs describe the increasingly international organization of production structures.
As more and more regional trade agreements come into force,
which drive down trade costs and harmonize product standards,
it becomes more and more attractive for firms to outsource certain tasks of their production lines.
Research on international trade analysing this development evolves quickly and reveals important implications of GVCs for economic growth and competitiveness.
decompr aims at facilitating this reasearch by simplifying the calculation of standard GVC indicators.
The purpose is to accelerate the research and, especially, to make it accesible to a wider audience.
We have designed the package using a modular structure, with an additional user interface function for increased ease of use.
The modular structure enables users to break the computationally intensive analysis process down into several steps.
Furthermore, the modular structure enables users and other developers to build on top of basic data structures which are created by the \verb!load_tables_vectors! function when implementing other decompositions or analyses.
However, a wrapper function (\verb!decomp!) is also provided, which combines the use of the atomic functions into one.
Lastly, in addition to the decompr function, we provide a Rcmdr plugin \parencite{fox2005getting, fox2007extending}, which allows the user to perform the analytical process using a GUI (Grapical User Interface).
All of this should allow users of the package to adapt the package to their specific needs as the GVC research progresses.
Since GVCs constitute a fairly new field of research, there are many ways forward for its analysis.
The next central step is to examine both in theory and empirically how GVC participation affects real economic activity.
More specifically, it is very relevant to look at how, for instance,
employment and economic growth react when countries join GVCs and what the factors are that determine a successful relationship.
From the standpoint of developing and emerging countries a very interesting question is if GVCs simplify industrialization
and the formation of comparative advantage
while high-income countries might look for an additional push for their stagnating post-crisis economies.
We hope that decompr can play a part in this field and promote it.
\nocite{wickham2014advanced}
\nocite{fox2012rcmdrplugin}
\vspace{\stretch{1}}
\section*{Colophon}
This paper was written in a combination of R \parencite{core2014r} and \LaTeX ~\parencite{lamport1986document},
specifically \LuaTeX ~\parencite{hagen2005luatex}, with biblatex and biber \parencite{lehman2006biblatex} for citations,
using Sweave syntax \parencite{leisch2003sweave} and compiled using knitr \parencite{yihui2013knitr} and Pandoc \parencite{macfarlane2012pandoc}.
\newpage
\printbibliography
\end{document}