What we shall answer

  • What is the total annual Dominican import and export?
  • Who are the main trading partners?
  • What type of goods are traded from China?

Comtrade data

UN Comtrade is a repository of official international trade statistics and relevant analytical tables. It allows to view and download detailed global trade data, i.e. imports and exports of all goods or even of specific services or goods (say tomatoes).

data_dr_goods %>% 
  filter(year >= 2005) %>%
  as_tibble() %>% 
  filter(reporter == "Dominican Rep.", partner %in% c("USA", "China")) %>% 
  select(trade_value_usd, reporter, partner, everything()) %>% 
  ggplot(aes(x = year, y = trade_value_usd/1000000, fill = partner)) +
  geom_col(alpha = 0.6, position = "dodge") +
  scale_y_continuous(labels = scales::number) +
  scale_x_continuous(breaks = seq(2005, 2018, 1)) +
  labs(title = "Dominican imports from USA and from China", y = "million USD") +
  theme_bw()

Balance of trade

data1 <- data_dr_goods %>% #distinct() %>% 
  filter(year >= 2005) %>%
  filter(partner_iso != "WLD") %>% 
  mutate(trade_value_usd_mm = million.f(trade_value_usd)) %>% 
  group_by(trade_flow, year) %>% 
  summarise(trade_value_usd_mm = sum(trade_value_usd_mm, na.rm = T))

data1 %>% 
  ggplot(aes(x = year, y = trade_value_usd_mm, color = trade_flow)) +
  # geom_area(alpha = 0.1, position = "identity") +
  geom_line() +
  geom_point() +
  # scale_y_continuous(labels = scales::number, breaks = seq(0, 2500, 500)) +
  scale_color_manual(values = c("#88be3f", "#02a7eb")) +
  scale_x_continuous(breaks = seq(2005, 2018, 1), expand = c(0.01, 0.01)) +
  labs(title = "Dominican import and exports over time",
       x = "", y = "trade value in million USD", caption = "Data: UN Comtrade", color = "", fill = "")

In 2018 the balance of trade in goods was in deficit by -12,607

Current account? What about services?

services <- data_dr_srvs %>% 
  filter(partner == "World") %>% 
  group_by(year, trade_flow) %>% 
  summarise(trade_value_usd_mm = sum(trade_value_usd)/1000000) %>% 
  spread(trade_flow, trade_value_usd_mm)

format.dt.f(services)

Of course, there’s more to the current account than just the trade in good. There’s trade in services, the Dominican’s income abroad, and current transfers. For the former we have the latest services data from Cometrade dates from 2018. The Dominican imported services of 3,224 million USD while it exported services for 9,225 mm USD. The surplus here is 6,001 mm USD.

To put this into perspective, the balance of trade in goods was at -12,607. The balance of trade goods and services would therefore be -6,606 mm USD (2018).

We shall focus on the exchange of goods in the following.

Trading partners

Who are the Dominican’ main trading partners? Again here’s the total import and exports for the year 2018.

trade.plot.f(data_dr_goods, top_n = 0, include_others = T, include_flags = T, include_share = F)

Let’s see the \(24\) top trading parters of the Dominican Republic.

# trade.plot.f(us, top_n = 25, include_others = F, include_flags = T)

trade.plot.f(data_dr_goods, top_n = 24, include_others = T, include_flags = T, include_share = T)

Immediately visible are the imports from the United States. With 9,647 mm USD. That’s 43% of all Dominican imports. Exports to USA (5,217 mm USD) only account for 56% of all exports.

Over time

Here’s the imports from the \(5\) todays major trading partners:

top_5 <- data_dr_goods %>% 
  filter(partner_iso != "WLD", year == 2018) %>% 
  group_by(partner_iso) %>% 
  tally(trade_value_usd, sort = T) %>% 
  top_n(5) %>% 
  pull(partner_iso)

data_dr_goods %>% 
  filter(partner_iso %in% top_5, trade_flow == "Import") %>% 
  ggplot(aes(x = year, y = million.f(trade_value_usd), color = partner_iso)) +
  geom_line() +
  scale_x_continuous(breaks = seq(2005, 2018, 1)) +
  labs(title = "Dominican imports of the current top-5 trading partners",
       x = "", y = "trade value in million USD", color = "",
       caption = "Date: UN Comtrade")

It’s also interesting to view it as share of total imports.

top_5 <- data_dr_goods %>% 
  filter(partner_iso != "WLD", year == 2018) %>% 
  group_by(partner_iso) %>% 
  tally(trade_value_usd, sort = T) %>% 
  top_n(5) %>% 
  pull(partner_iso)

data_dr_goods %>% 
  filter(year >= 2005) %>%
  filter(partner_iso != "WLD", trade_flow == "Import") %>% 
  group_by(year) %>% 
  mutate(share_of_total = trade_value_usd/sum(trade_value_usd)) %>% 
  ungroup() %>% 
  filter(partner_iso %in% top_5, trade_flow == "Import") %>% 
  ggplot(aes(x = year, y = share_of_total, color = partner_iso)) +
  geom_line() +
  scale_x_continuous(breaks = seq(2005, 2018, 1)) +
  scale_y_continuous(labels = scales::percent, breaks = seq(0.04, 0.5, by = 0.02)) +
  labs(title = "Dominican imports of the current top-5 trading partners (relative)",
       x = "", y = "share of all imports", color = "",
       caption = "Date: UN Comtrade")

Imports from China

top_com <- data_dr_china %>% 
  group_by(commodity) %>% 
  tally(trade_value_usd, sort = T) %>% 
  top_n(10) %>% 
  pull(commodity)

others <- data_dr_china %>% 
  filter(!(commodity %in% top_com)) %>% 
  group_by(trade_flow) %>% 
  summarise(trade_value_usd = sum(trade_value_usd)) %>% 
  mutate(commodity = "Others")
  
data_dr_china %>% 
  filter(commodity %in% top_com) %>% 
  bind_rows(others) %>% 
  mutate(trade_value_usd_mm = million.f(trade_value_usd)) %>% 
  select(trade_flow, trade_value_usd_mm, commodity) %>% 
  # arrange(-trade_value_usd) %>% 
  ggplot(aes(y = trade_value_usd_mm, x = trade_flow,  fill = factor(str_sub(commodity, 1, 35), levels = str_sub(c(top_com, "Others"), 1, 35)))) +
  geom_col() +
  geom_text(aes(label = number(trade_value_usd_mm)), position = position_stack(vjust = .5)) +
  scale_fill_brewer(palette = "Set3") +
  scale_y_continuous(labels = scales::number) +
  labs(title = "Classification by goods traded",
       subtitle = "reporter: Dominican Rep., partner: China, year 2018",
       x = "", y = "Cumulated trade value in million USD",
       fill = "",
       caption = "Data: UN Comtrade")

format.dt.f(data_dr_china)