[This article was first published on DataGeeek, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)


Want to share your content on R-bloggers? click here if you have a blog, or here if you don’t.

Japanese Finance Minister Shunichi Suzuki recently said that the volatility in USD/JPY rates negatively impacts the price competition and even damages the profit of the exporters in Japan. To examine this claim, first, we will look at the movement of the exports of goods and services in Japan, Nikkei 225, and exchange rates together.

library(tidyverse)
library(tidymodels)
library(tidyquant)
library(timetk)
library(modeltime)

#Quarterly change (%) of USD/JPY exchange rates
#https://finance.yahoo.com/quote/JPY%3DX/
df_usdjpy <-
  tq_get("JPY=x", to = "2024-07-01") %>%
  tq_transmute(select = "close",
               mutate_fun = to.quarterly) %>%
  tq_transmute(mutate_fun = periodReturn,
               period = "quarterly",
               col_rename = "usd_jpy")



#Quarterly change (%) of exports of goods and services in Japan
#https://fred.stlouisfed.org/series/JPNEXPORTQDSNAQ
df_exports <-
  tq_get("JPNEXPORTQDSNAQ",
         get = "economic.data") %>%
  select(date, exports = price) %>%
  mutate(date = as.yearqtr(date),
         exports = exports / lag(exports) - 1) %>%
  drop_na()


#Quarterly change (%) of Nikkei 225
#https://finance.yahoo.com/quote/%5EN225/
df_nikkei <-
  tq_get("^N225", to = "2024-07-01") %>%
  tq_transmute(select = "close",
               mutate_fun = to.quarterly) %>%
  tq_transmute(mutate_fun = periodReturn,
               col_rename = "nikkei225")


#Merging series
df_merged <-
  df_exports %>%
  left_join(df_usdjpy) %>%
  left_join(df_nikkei)


#Change of quarterly %
df_merged %>%
  pivot_longer(-date, names_to = "vars") %>%
  filter(date >= 2021) %>%
  mutate(type = case_when(
    vars == "exports" ~ "Exports in Japan",
    vars == "usd_jpy" ~ "USD/JPY",
    vars == "nikkei225" ~ "Nikkei 225",
    TRUE ~ vars
  )) %>%
  ggplot(aes(date, value, color = vars)) +
  geom_line(linewidth = 1.25) +
  geom_text(
    data = . %>%  slice_tail(n = 1, by = type),
    aes(label = type),
    hjust = 0,
    vjust = 0,
    family = "Bricolage Grotesque",
    nudge_x = 0.05,
    size = 5
  ) +
  scale_y_continuous(labels = scales::percent) +
  scale_x_yearqtr(format = "%Y Q%q",
                  expand = expansion(mult = c(0, .3))) +
  labs(x = "",
       y = "",
       subtitle = "Change of quarterly %") +
  theme_minimal(base_family = "Bricolage Grotesque",
                base_size = 16) +
  theme(legend.position = "none",
        panel.grid.minor = element_blank())

When we look at the chart above, we can say that exchange rates and exports diverged in the opposite direction in the last quarter, but this still shows no evidence of a relationship between them. To examine whether there is a significant effect of the exchange rate on exports, we will use bootstrap confidence intervals.

#Bootstrap confidence intervals
set.seed(12345)
jpn_intervals <-
  reg_intervals(exports ~ usd_jpy,
                data = df_merged,
                model_fn = "glm",
                keep_reps = TRUE)


jpn_intervals %>%
  unnest(.replicates) %>%
  ggplot(aes(estimate, fill = term)) +
  geom_vline(xintercept = 0, size = 1.5, lty = 2, color = "gray50") +
  geom_histogram(alpha = 0.8, show.legend = FALSE) +
  labs(x = "",
       y = "",
       subtitle = "The distribution includes zero which means there is no significant effect",
       title = "The estimated effect of USD/JPY rates on exports in Japan") +
  theme_minimal(base_family = "Bricolage Grotesque") +
  theme(axis.text = element_text(size = 16),
        plot.title = element_text(size = 16))

According to our simulation results, there seems no significant effect of USD/JPY exchange rates on exports of goods and services in Japan.

To leave a comment for the author, please follow the link and comment on their blog: DataGeeek.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you’re looking to post or find an R/data-science job.


Want to share your content on R-bloggers? click here if you have a blog, or here if you don’t.

Continue reading: Bootstrap Confidence Intervals: Exports in Japan

An Analysis of USD/JPY Exchange Rates and Japan’s Exports: Long-term Implications

Upon a detailed analysis of the claim laid by Japan’s Finance Minister Shunichi Suzuki that the volatility of the USD/JPY exchange rates negatively impacts the price competition and hampers the profit margins of Japanese exporters, we found that the impacts may not be as significant as suggested. This is based on the gathered data and the subsequent simulations conducted.

Analysis of the Data and Simulations

The data was acquired from various reliable sources and then merged for a more comprehensive analysis. The quarterly change (%) of USD/JPY exchange rates, exports of goods and services in Japan, and Nikkei 225 were closely examined, and then compared.

According to the chart that resulted from the data analysis, it was observed that the exchange rates and exports seemed to diverge in the opposite directions in the last quarter. However, this observed divergence doesn’t explicitly define any particular relationship between exports and exchange rates. To further test this, we used a bootstrap method to create confidence intervals.

Upon examining the bootstrap confidence interval simulation results, we observed no significant effect of the fluctuation of the USD/JPY exchange rates on the exports of goods and services in Japan.

Future Developments and Long-term Implications

Exchange Rate Variability: As the global economy continues to evolve, the USD/JPY exchange rate will continue to fluctuate. Although we observed no significant effect on exports due to the exchange rate, the economic variables are interconnected, and at a macroeconomic level, the volatility could bear more significant over the long run.

Changes in Global Trade Rules: Changes in global trading rules can also significantly impact Japan’s export sector. Exporters in Japan will need to adapt to these transformations to stay competitive and profitable.

Actionable Advice

  1. Constant Monitoring: The analysis suggests no significant effect of exchange rate volatility on the exports, but this may change due to various global economic events. So it’s crucial to constantly monitor these rates.
  2. Flexible Business Strategy: Japanese exporters should maintain a flexible business strategy to adapt to changes in the global economy and trading rules.
  3. Investing in Research & Development: Exporters in Japan should invest in researching and understanding the global market trends to aid in developing strategies that are responsive to global economic shifts.

While the current analysis suggests that there’s no significant effect of USD/JPY exchange rates on Japan’s exports, the economic landscape is not fixed and will continue to evolve. Constant vigilance and adaptability are key to maintaining profitability in such a dynamic market.

Read the original article