R Markdown
codes <- read_xlsx("Codes.xlsx")
p_union <- read.csv("Union.csv")
w_hours <- read.csv("Mean weekly hours manufacture.csv")
a_cost <- read.csv("Average monthly earnings manufacture.csv")
gdp <- read.xlsx("GDP.xlsx")
gvc_trade <- read.xlsx("Backward Participation.xlsx")
n_compl <- read.csv("Level of national compliance with labour rights.csv")
#Prepare codes
codes <- codes[,c(1,2)]
#Edit GDP (USD)
gdp <- right_join(codes, gdp)
gdp <- gdp[,-3]
gdp_all <- gdp[,-2]
gdp_all <- pivot_longer(gdp_all,
cols = -Country,
names_to = "Year",
values_to = "GDP")
gdp_all <- right_join(codes, gdp_all, relationship = "many-to-many")
colnames(gdp_all)[2] <- c("Code")
gdp_all$Year <- as.numeric(gdp_all$Year)
#Edit GVC backward participation manufacture (% of trade)
gvc_trade_all <- pivot_longer(gvc_trade,
cols = -Country,
names_to = "Year",
values_to = "GVC")
gvc_trade_all$Year <- as.numeric(gvc_trade_all$Year)
#Edit Union, Hours, Cost, Compliance
p_union <- left_join(p_union, codes)
p_union <- p_union[c(8,1,4,5)]
colnames(p_union) <- c("Country", "Code", "Year", "Value")
p_union$Year <- as.numeric(p_union$Year)
w_hours <- left_join(w_hours, codes)
w_hours <- w_hours[c(13,1,7,8)]
colnames(w_hours) <- c("Country", "Code", "Year", "Value")
w_hours$Year <- as.numeric(w_hours$Year)
a_cost <- left_join(a_cost, codes)
a_cost <- a_cost[c(13,1,7,8)]
colnames(a_cost) <- c("Country", "Code", "Year", "Value")
a_cost$Year <- as.numeric(a_cost$Year)
n_compl <- left_join(n_compl, codes)
n_compl <- n_compl[c(6,1,4,5)]
colnames(n_compl) <- c("Country", "Code", "Year", "Value")
n_compl$Year <- as.numeric(n_compl$Year)
p_union_all <- p_union
w_hours_all <- w_hours
a_cost_all <- a_cost
n_compl_all <- n_compl
p_union <- reshape(p_union, timevar = "Year", idvar = c("Country", "Code"), direction = "wide")
w_hours <- reshape(w_hours, timevar = "Year", idvar = c("Country", "Code"), direction = "wide")
a_cost <- reshape(a_cost, timevar = "Year", idvar = c("Country", "Code"), direction = "wide")
n_compl <- reshape(n_compl, timevar = "Year", idvar = c("Country", "Code"), direction = "wide")
#New table Cost + GVC
all1 <- left_join(gvc_trade_all,a_cost_all)
all1 <- na.omit(all1[,c(1,4,2,3,5)])
colnames(all1) <- c("Country","Code", "Year","GVC", "Cost")
all1 <- left_join(all1, gdp_all)
all1 <- na.omit(all1)
#New table Union + GVC
all2 <- left_join(gvc_trade_all,p_union_all)
all2 <- na.omit(all2[,c(1,4,2,3,5)])
all2 <- left_join(all2, gdp_all)
colnames(all2) <- c("Country","Code", "Year","GVC", "Union", "GDP")
#New table Hours + GVC
all3 <- left_join(gvc_trade_all,w_hours_all)
all3 <- na.omit(all3[,c(1,4,2,3,5)])
all3 <- left_join(all3, gdp_all)
colnames(all3) <- c("Country","Code", "Year","GVC", "Hours", "GDP")
#New table Compliance + GVC
all4 <- left_join(gvc_trade_all,n_compl_all)
all4 <- na.omit(all4[,c(1,4,2,3,5)])
all4 <- left_join(all4, gdp_all)
colnames(all4) <- c("Country","Code", "Year","GVC", "Compliance", "GDP")
#New table all variables GVC
all5 <- left_join(all1, all2)
all5 <- left_join(all5, all3)
all5 <- left_join(all5, all4)
all5 <- na.omit(all5)
#Graphs
g1 <- ggplot(all1, aes(Cost, GVC))+geom_point()+ylab("GVC Participation")+xlab("Labour Cost")#+geom_smooth()+geom_label(label= all1$Country)+scale_y_log10()
g1

g2 <- ggplot(all2, aes(Union, GVC))+geom_point()+ylab("GVC Participation")+xlab("Union")#+scale_y_log10()+geom_label(label= all2$Country)
g2

g3 <- ggplot(all3, aes(Hours, GVC))+geom_point()+ylab("GVC Participation")+xlab("Hours")+scale_y_log10()#+geom_label(label= all3$Country)
g3

g4 <- ggplot(all4, aes(Compliance, GVC))+geom_point()+ylab("GVC Participation")+xlab("Compliance")+scale_y_log10()#+geom_label(label= all3$Country)
g4

## Regressions
model_gvc <- lm(GVC ~ Cost + Compliance + Hours + Union + log(GDP) + Year, data = all5)
summary(model_gvc)
##
## Call:
## lm(formula = GVC ~ Cost + Compliance + Hours + Union + log(GDP) +
## Year, data = all5)
##
## Residuals:
## Min 1Q Median 3Q Max
## -11.2530 -3.1900 -0.2695 2.7721 10.1377
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.157e+03 1.108e+03 -3.754 0.000979 ***
## Cost -4.718e-03 2.027e-03 -2.328 0.028651 *
## Compliance 3.584e-01 1.081e+00 0.331 0.743227
## Hours 8.878e-01 6.776e-01 1.310 0.202578
## Union 5.171e-01 8.570e-02 6.034 3.13e-06 ***
## log(GDP) 3.271e+00 3.057e+00 1.070 0.295160
## Year 2.038e+00 5.473e-01 3.723 0.001057 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.173 on 24 degrees of freedom
## Multiple R-squared: 0.8138, Adjusted R-squared: 0.7672
## F-statistic: 17.48 on 6 and 24 DF, p-value: 1.085e-07
model_cost <- lm(Cost ~ GVC + log(GDP), data = all5)
summary(model_cost)
##
## Call:
## lm(formula = Cost ~ GVC + log(GDP), data = all5)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1076.1 -348.1 136.3 424.4 1165.7
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -10004.42 1174.57 -8.518 2.93e-09 ***
## GVC -32.44 11.28 -2.875 0.00764 **
## log(GDP) 1312.59 110.70 11.857 1.97e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 622.2 on 28 degrees of freedom
## Multiple R-squared: 0.8747, Adjusted R-squared: 0.8657
## F-statistic: 97.71 on 2 and 28 DF, p-value: 2.357e-13
model_union <- lm(Union ~ GVC + log(GDP), data = all5)
summary(model_union)
##
## Call:
## lm(formula = Union ~ GVC + log(GDP), data = all5)
##
## Residuals:
## Min 1Q Median 3Q Max
## -18.211 -4.478 -2.213 6.009 18.983
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -75.074 19.677 -3.815 0.000688 ***
## GVC 1.051 0.189 5.561 6.01e-06 ***
## log(GDP) 6.955 1.855 3.750 0.000817 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 10.42 on 28 degrees of freedom
## Multiple R-squared: 0.5538, Adjusted R-squared: 0.5219
## F-statistic: 17.37 on 2 and 28 DF, p-value: 1.241e-05
model_hours <- lm(Hours ~ GVC + log(GDP), data = all5)
summary(model_hours)
##
## Call:
## lm(formula = Hours ~ GVC + log(GDP), data = all5)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.8141 -1.7394 -0.4981 0.9878 4.9702
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 60.73525 4.90729 12.377 7.16e-13 ***
## GVC -0.01433 0.04714 -0.304 0.763362
## log(GDP) -1.80523 0.46250 -3.903 0.000544 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.6 on 28 degrees of freedom
## Multiple R-squared: 0.3702, Adjusted R-squared: 0.3252
## F-statistic: 8.229 on 2 and 28 DF, p-value: 0.001545
model_compl <- lm(Compliance ~ GVC + log(GDP), data = all5)
summary(model_compl)
##
## Call:
## lm(formula = Compliance ~ GVC + log(GDP), data = all5)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.9904 -0.9594 -0.2036 0.6532 4.0063
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 11.170572 2.922384 3.822 0.000675 ***
## GVC -0.004858 0.028075 -0.173 0.863870
## log(GDP) -0.824109 0.275427 -2.992 0.005728 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.548 on 28 degrees of freedom
## Multiple R-squared: 0.2589, Adjusted R-squared: 0.206
## F-statistic: 4.892 on 2 and 28 DF, p-value: 0.01506