decompr
de Bastiaan QuastAbstract
This is an undergrad student level instruction for class use.This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
License: CC BY-SA 4.0
Sugestão de citação: FIGUEIREDO, Adriano Marcos Rodrigues. GVC com R: reprodução do decompr
de Bastiaan Quast. Campo Grande-MS,Brasil: RStudio/Rpubs, 2019. Disponível em http://rpubs.com/amrofi/decompr_vignette.
Esta é a reprodução do script de Quast (2015), pacote decompr
, cuja vignette está em https://raw.githubusercontent.com/amrofi/decompr/master/vignettes/decompr.Rmd.
Começamos carregando o pacote e o data set de exemplo leather
.
# install.packages('decompr')
library(decompr)
data(leather) # este data set carrega os objetos countries, final, industries, inter e out
# helps opcionais seriam help('countries'), help('industries')
help("decomp") # Interface function for decompositions
help("countries")
# industries
help("leontief") # Leontief Decomposition
help("wwz") # Runs the Wang-Wei-Zhu decomposition
help("load_tables_vectors") # Load the Input-Output and Final demand tables
Listar os objetos de dados incluídos.
ls()
[1] "countries" "final" "industries" "inter" "out"
Ver cada objeto individualmente.
inter
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,] 16.1 5.1 1.8 3.2 4.3 0.4 3.1 2.8 4.9
[2,] 2.4 8.0 3.2 0.1 3.2 1.6 1.2 3.9 11.5
[3,] 0.9 0.5 4.0 0.0 0.1 0.3 0.0 0.4 0.5
[4,] 1.1 1.9 0.2 18.0 13.2 6.1 9.0 3.1 8.9
[5,] 0.3 2.8 0.1 6.1 28.1 6.3 2.1 2.5 25.6
[6,] 0.0 0.1 0.3 4.1 3.2 8.9 0.2 0.0 1.8
[7,] 1.2 4.2 0.3 4.1 1.2 0.6 29.0 19.5 17.9
[8,] 1.3 1.1 0.0 3.2 4.8 2.6 5.1 29.1 24.1
[9,] 2.1 1.4 3.0 4.1 3.1 3.9 11.3 8.1 51.3
final
[,1] [,2] [,3]
[1,] 21.5 6.1 8.4
[2,] 16.2 1.9 5.1
[3,] 11.0 0.5 0.8
[4,] 7.5 29.5 14.2
[5,] 8.9 24.9 16.9
[6,] 1.2 18.5 4.9
[7,] 9.2 17.9 51.2
[8,] 7.9 10.1 38.5
[9,] 25.1 35.2 68.4
countries
[1] "Argentina" "Turkey" "Germany"
industries
[1] "Agriculture" "Textile_and_Leather" "Transport_Equipment"
out
[1] 77.7 58.3 19.0 112.7 124.6 43.2 156.3 127.8 217.0
decomp(inter, final, countries, industries, out, method = "leontief")
decomp(inter, final, countries, industries, out, method = "wwz")
R Core Team (2019). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.
Quast, B.A. and V. Kummritz (2015). gvc: Global Value Chain analysis in R.