The United Kingdom Input-Output Analytical Tables 2010 are used for testing the iotables
package, because they are well-documented and detailed, organized data is available with them. The analytical tables are published in an Excel table. A special reader function (which is not exported) was created to read-in all sheets of the Excel table.
It is unlikely that these tables will be required by other purposes than controlling the package. The UK IO tables for other years are available these are consistent with different Blue Books and there could therefore be important methodological and classification changes. Furthermore, ONS currently publishes ESA2010 compatible SIOTs with analytical tables annually.
<- iotables_download ( source = "uk_2010" )
uk_2010_data save ( uk_2010_data, file = file.path('data-raw', 'uk_2010_data.rda'))
<- iotables:::uk_2010_results_get ()
uk_test_results #saved as package data
For the actual symmetric input-output table (see ) you can use the download function originally designed for the Eurostat bulk downloader.
library(iotables)
data(uk_2010_data)
<- iotable_get (
uk_siot labelled_io_data = uk_2010_data,
source = "uk_2010_siot" )
<- iotable_get (
uk_published_coeff labelled_io_data = uk_2010_data,
source = "uk_2010_coeff" )
<- iotable_get (
uk_published_inverse labelled_io_data = uk_2010_data,
source = "uk_2010_inverse" )
The matrix of coefficients is described on page 14-15 and the data can be found in the Matrix of coefficients (product by product) sheet of the Excel file.
<- input_coefficient_matrix_create(data_table = uk_siot)
uk_input_coeff
<- select (uk_input_coeff, 1 ) %>%
coeff_comparison left_join ( uk_published_coeff, by = "prod_na")
test_that("correct data is returned", {
expect_equal(round(uk_input_coeff[,2:8], 8),
round(coeff_comparison [,2:8], 8)) })
#> Test passed
Comparing the first 7 columns of the two coefficient matrixes at 8 decimal point precision they are equal. Given the size of the matrixes, not all the matrix is compared here, but such a comparison can be made. However, it is not necessary, because the latter results would show a deviation if parts of the matrix would be different.
The Leontief-inverse is described on pages 16-17 of the article. Again, comparing the first seven numerical columns at 8 digit precision we see that the re-calculated inverse and the published inverse is the same.
<- leontief_inverse_create(uk_input_coeff)
uk_calculated_inverse
<- select (uk_calculated_inverse, 1 ) %>%
inverse_comparison left_join (uk_calculated_inverse, by = "prod_na")
test_that("correct data is returned", {
expect_equal(round(uk_calculated_inverse[,2:8], 8),
round(inverse_comparison[,2:8], 8)) })
#> Test passed
<- uk_test_results %>%
employment_effect_results select ( uk_row_label, `Employment cost effects`)
<- coefficient_matrix_create(
primary_inputs_uk data_table = uk_siot,
total = 'output',
return_part = 'primary_inputs')
<- filter (primary_inputs_uk , prod_na == "D1")
employment_input
<- direct_effects_create( employment_input, uk_calculated_inverse ) %>%
employment_effects gather ( prod, values, !!2:ncol(.)) %>%
mutate ( prod_na = prod ) %>%
select ( -prod ) %>%
left_join ( select ( metadata_uk_2010, prod_na, uk_row_label ),
by = 'prod_na') %>%
left_join ( employment_effect_results, by = 'uk_row_label' ) %>%
filter ( !is.na(uk_row_label )) %>%
select ( prod_na, uk_row_label, values, `Employment cost effects`)
:::create_knitr_table (
iotablesdata_table = employment_effects[1:10,],
digits = 4,
caption = "Comparison of Calculated And Published Employment Cost Effects",
col.names = c("industry code", "row label", "calculated", "published"),
col_width = c(2,11,3,3))
industry code | row label | calculated | published |
---|---|---|---|
CPA_01 | Products of agriculture, hunting and related services | 0,3682 | 0,3682 |
CPA_02 | Products of forestry, logging and related services | 0,4683 | 0,4683 |
CPA_03 | Fish and other fishing products; aquaculture products; support services to fishing | 0,2234 | 0,2234 |
CPA_05 | Coal and lignite | 0,4644 | 0,4644 |
CPA_06-07 | Crude petroleum and natural gas & Metal ores | 0,1657 | 0,1657 |
CPA_08 | Other mining and quarrying products | 0,4305 | 0,4305 |
CPA_09 | Mining support services | 0,1993 | 0,1993 |
CPA_10_1 | Preserved meat and meat products | 0,4776 | 0,4776 |
CPA_10_2-3 | Processed and preserved fish, crustaceans, molluscs, fruit and vegetables | 0,5301 | 0,5301 |
CPA_10_4 | Vegetable and animal oils and fats | 0,3786 | 0,3786 |
The comparison of output mulitipliers show that our code gives the same results. Only ten industries are shown.
GVA is not shown in the Excel table explicitly, but can be calculated as the sum of corporate income (Operating surplus and mixed income), household income (Compensation of employees) and net taxes on production (not products.)
<- uk_siot %>%
uk_siot2 filter ( prod_na %in% c("B2A3G", "D1", "D29X39") ) %>%
summarize_if ( is.numeric, sum, na.rm = TRUE ) %>%
cbind ( data.frame ( prod_na = "GVA"), . ) %>%
rbind ( uk_siot, .)
<- uk_test_results %>%
gva_effect_results select ( uk_row_label, `GVA effects`)
<- coefficient_matrix_create(
gva_input data_table = uk_siot2,
total = 'output',
return_part = 'primary_inputs') %>%
filter ( prod_na == "GVA" )
<- direct_effects_create( gva_input,
gva_effects %>%
uk_calculated_inverse ) gather ( prod, values, !!2:ncol(.)) %>%
mutate ( prod_na = prod ) %>%
select ( -prod ) %>%
left_join ( select ( metadata_uk_2010, prod_na, uk_row_label ),
by = 'prod_na') %>%
left_join ( gva_effect_results, by = 'uk_row_label' ) %>%
filter ( !is.na(uk_row_label )) %>%
select ( prod_na, uk_row_label, values, `GVA effects`)
:::create_knitr_table (
iotablesdata_table = gva_effects[1:10,],
digits = 4,
caption = "Comparison of Calculated And Published GVA Effects",
col.names = c("industry code", "row label", "calculated", "published"),
col_width = c(2,11,3,3))
industry code | row label | calculated | published |
---|---|---|---|
CPA_01 | Products of agriculture, hunting and related services | 0,6910 | 0,6910 |
CPA_02 | Products of forestry, logging and related services | 0,7472 | 0,7472 |
CPA_03 | Fish and other fishing products; aquaculture products; support services to fishing | 0,7076 | 0,7076 |
CPA_05 | Coal and lignite | 0,6631 | 0,6631 |
CPA_06-07 | Crude petroleum and natural gas & Metal ores | 0,9048 | 0,9048 |
CPA_08 | Other mining and quarrying products | 0,7193 | 0,7193 |
CPA_09 | Mining support services | 0,8963 | 0,8963 |
CPA_10_1 | Preserved meat and meat products | 0,6751 | 0,6751 |
CPA_10_2-3 | Processed and preserved fish, crustaceans, molluscs, fruit and vegetables | 0,7251 | 0,7251 |
CPA_10_4 | Vegetable and animal oils and fats | 0,5628 | 0,5628 |
Turning to multipliers, using the same inputs we get them back with the following code.
<- uk_test_results %>%
empc_multiplier_results select ( uk_row_label, `Employment cost multiplier`)
<- coefficient_matrix_create(
empc_indicator_uk data_table = uk_siot,
total = 'output',
return_part = 'primary_inputs') %>%
filter ( prod_na == 'D1')
<- input_multipliers_create(
empc_multipliers input_requirements = empc_indicator_uk,
%>%
uk_calculated_inverse) gather ( prod, values, !!2:ncol(.)) %>%
mutate ( prod_na = prod ) %>%
select ( -prod ) %>%
left_join ( select ( metadata_uk_2010, prod_na, uk_row_label ),
by = 'prod_na') %>%
left_join ( empc_multiplier_results, by = 'uk_row_label' ) %>%
filter ( !is.na(uk_row_label )) %>%
select ( prod_na, uk_row_label, values, `Employment cost multiplier`)
:::create_knitr_table (
iotablesdata_table = empc_multipliers [1:10,], digits = 4,
caption = "Comparison of Calculated And Published Employment Cost Multipliers",
col.names = c("industry code", "row label", "calculated", "published"),
col_width = c(2,11,3,3))
industry code | row label | calculated | published |
---|---|---|---|
CPA_01 | Products of agriculture, hunting and related services | 2,1111 | 2,1111 |
CPA_02 | Products of forestry, logging and related services | 2,3892 | 2,3892 |
CPA_03 | Fish and other fishing products; aquaculture products; support services to fishing | 2,7088 | 2,7088 |
CPA_05 | Coal and lignite | 1,6419 | 1,6419 |
CPA_06-07 | Crude petroleum and natural gas & Metal ores | 2,2748 | 2,2748 |
CPA_08 | Other mining and quarrying products | 1,4642 | 1,4642 |
CPA_09 | Mining support services | 3,3424 | 3,3424 |
CPA_10_1 | Preserved meat and meat products | 2,4978 | 2,4978 |
CPA_10_2-3 | Processed and preserved fish, crustaceans, molluscs, fruit and vegetables | 1,8343 | 1,8343 |
CPA_10_4 | Vegetable and animal oils and fats | 1,6153 | 1,6153 |
Following from the GVA effects, after summarizing GVA and adding it to the input requirements we can calculate the GVA multipliers
.
<- input_multipliers_create(
gva_multipliers input_requirements = gva_input,
%>%
uk_calculated_inverse) gather ( prod, values, !!2:ncol(.)) %>%
mutate ( prod_na = prod ) %>%
select ( -prod ) %>%
left_join ( select ( metadata_uk_2010, prod_na, uk_row_label ),
by = 'prod_na') %>%
left_join ( gva_multiplier_results, by = 'uk_row_label' ) %>%
filter ( !is.na(uk_row_label )) %>%
select ( prod_na, uk_row_label, values, `GVA multiplier`)
:::create_knitr_table (
iotablesdata_table = gva_multipliers [1:10,], digits = 4,
caption = "Comparison of Calculated And Published GVA Multipliers",
col.names = c("industry code", "row label", "calculated", "published"),
col_width = c(2,11,3,3))
:::create_knitr_table (
iotablesdata_table = gva_multipliers [1:10,],
digits = 4,
caption = "Comparison of Calculated And Published GVA Multipliers",
col.names = c("industry code", "row label",
"calculated", "published"),
col_width = c(2,11,3,3))
At last, the comparison of output mulitipliers show that our code gives the same results. Only ten industries are shown.
<- uk_test_results %>%
output_multiplier_results select ( uk_row_label, `Output multiplier`)
<- output_multiplier_create(uk_input_coeff) %>%
uk_output_multipliers gather ( prod, values, !!2:ncol(.)) %>%
mutate ( prod_na = prod ) %>%
select ( -prod ) %>%
left_join ( select ( metadata_uk_2010, prod_na, uk_row_label ),
by = 'prod_na') %>%
left_join ( output_multiplier_results,
by = 'uk_row_label' ) %>%
filter ( !is.na(uk_row_label) ) %>%
select ( prod_na, uk_row_label, values, `Output multiplier`)
:::create_knitr_table (
iotablesdata_table = uk_output_multipliers [1:10,],
digits = 4,
caption = "Comparison of Calculated And Published Output Multipliers",
col.names = c("industry code", "row label",
"calculated", "published"),
col_width = c(2,11,3,3))
industry code | row label | calculated | published |
---|---|---|---|
CPA_01 | Products of agriculture, hunting and related services | 1,8312 | 1,8312 |
CPA_02 | Products of forestry, logging and related services | 2,1187 | 2,1187 |
CPA_03 | Fish and other fishing products; aquaculture products; support services to fishing | 1,6284 | 1,6284 |
CPA_05 | Coal and lignite | 1,7891 | 1,7891 |
CPA_06-07 | Crude petroleum and natural gas & Metal ores | 1,4155 | 1,4155 |
CPA_08 | Other mining and quarrying products | 1,5231 | 1,5231 |
CPA_09 | Mining support services | 1,5692 | 1,5692 |
CPA_10_1 | Preserved meat and meat products | 2,2693 | 2,2693 |
CPA_10_2-3 | Processed and preserved fish, crustaceans, molluscs, fruit and vegetables | 1,9499 | 1,9499 |
CPA_10_4 | Vegetable and animal oils and fats | 1,6088 | 1,6088 |