R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot. ## Introduction Why do national leaders visit foreign countries? When leaders visit foreign countries, they incur significant costs in terms of preparation time and effort. In addition, during the leaders’ visits to foreign countries, domestic leaders are absent. This creates domestic political risks. What are the benefits of such costly visits? Although visits to foreign countries are possible for non-level government officials and embassy staff, heads of state go out of their way to make such visits. What are the differences between diplomacy by heads of state and diplomacy by other high-level officials? ## Approach Foreign visits for bilateral summits are planned with careful consideration of political and strategic factors (e.g., foreign policy priorities, bilateral relations, and the host country’s political climate). Then, selection bias can occur. To solve this inherent issue in the study of foreign visits, this research focuses on the G20 summit to explore the multifaceted effects of summit diplomacy. Since the G20 summit occurs regularly and leaders’ attendance is expected for all member states, absences are typically caused by unexpected domestic events or situations. ## Data and Analysis There are many previous studies on the effects of summit diplomacy. However, they are all limited to bilateral diplomacy. Therefore, we surveyed the press releases of the G20 member countries and compiled data on the dates of attendance announcements, the number of meetings held during the summit and their counterparts, and the volume of media coverage. As a result of our research, we formulated the following two hypotheses

H1: Leader attendance increases the media coverage among G20 countries. H2: Leader attendance increases the media coverage among G20 countries.

The period covered will be the 10year period from 2013 to 2023, when press releases from the member countries were available.There are two dependent variables. However, we remove 2020 G20 online summit with no incidental meetings because of COVID-19. The first is the number of meetings during the summit. We set the number of meetings as a whole (sum) and the number of bilateral meetings held only by heads of state (bi_leader). The second is the amount of media coverage of the summit by member countries, which is calculated in ProQuest as (“G20 Summit” OR “Host City Summit” OR “G-20 Summit”) AND ” Member Countries” and the number of articles containing these words (media_coverage_appear). We searched 11 streets in Host City and 20 streets in Member Countries. The time period covered was one month before and after the summit.

## preparing data of G20 Summit

library(googlesheets4)
library(ggplot2)

# importing data
# We use a package called googlesheet4 to download the latest sheets online every time.

sheet_url <- "https://docs.google.com/spreadsheets/d/16CRLIfl0p-O6hVxlavcaBj-UJTuvJu9khtee9gdBCqk/edit?usp=sharing"

sheet_names <- sheet_names(sheet_url)
## ! Using an auto-discovered, cached token.
##   To suppress this message, modify your code or options to clearly consent to
##   the use of a cached token.
##   See gargle's "Non-interactive auth" vignette for more details:
##   <https://gargle.r-lib.org/articles/non-interactive-auth.html>
## ℹ The googlesheets4 package is using a cached token for
##   'noritakablack@gmail.com'.
sheet_names <- sheet_names[!sheet_names %in% "read me"]

for (sheet_name in sheet_names) {
  sheet_data <- read_sheet(sheet_url, sheet = sheet_name)
  assign(sheet_name, sheet_data)
  cat("Loaded:", sheet_name, "as a data frame\n")
}
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''ARG''.
## Loaded: ARG as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''AUS''.
## Loaded: AUS as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''BRA''.
## Loaded: BRA as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''CAN''.
## Loaded: CAN as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''CHN''.
## Loaded: CHN as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''EU''.
## Loaded: EU as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''FRA''.
## Loaded: FRA as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''DEU''.
## Loaded: DEU as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''IND''.
## Loaded: IND as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''IDN''.
## Loaded: IDN as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''ITA''.
## Loaded: ITA as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''JPN''.
## Loaded: JPN as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''MEX''.
## Loaded: MEX as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''KOR''.
## Loaded: KOR as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''RUS''.
## Loaded: RUS as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''SAU''.
## Loaded: SAU as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''ZAF''.
## Loaded: ZAF as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''TUR''.
## Loaded: TUR as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''GBR''.
## Loaded: GBR as a data frame
## ✔ Reading from "G20Data_arranged".
## ✔ Range ''USA''.
## Loaded: USA as a data frame
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ lubridate 1.9.3     ✔ tibble    3.2.1
## ✔ purrr     1.0.2     ✔ tidyr     1.3.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# make dataframe with all G20 counties
ALL <- bind_rows(ARG, AUS, BRA, CAN, CHN, EU, FRA, DEU, IND, IDN, ITA, JPN, MEX, RUS, SAU, ZAF, KOR, TUR, GBR, USA)
View(ALL)

# Removing 2020 G20 online summit with no incidental meetings because of COVID-19
# Also remove unnecessary columns
ALL <- ALL %>%
  filter(Online_COVID == 0 ) %>%
  select(-Date_G20,
         -Online_COVID,
         -Nth_G20summit,
         -Date_declaration)

# standardize dependent variables
st_ALL <- ALL %>%
  group_by(Country) %>%
  mutate(across(bi_leader:last_col(),
                ~ (.-mean(., na.rm = TRUE)) / sd(., na.rm = TRUE)  # standardization
  )) %>%
  ungroup()

View(st_ALL)

##----------------------------------------------------------------
# Multiple OLS regression with dependent variables set to sum, bi_leader, media_coverage_appear.
mulsum <- lm(sum ~ Host_State+Leader_or_not, data = st_ALL)
mulbi <- lm(bi_leader ~ Host_State+Leader_or_not, data = st_ALL)
mulmed <- lm(media_coverage_appear ~ Host_State+Leader_or_not, data = st_ALL)

# see
library(stargazer)
## 
## Please cite as: 
## 
##  Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
stargazer(mulsum, mulbi, mulmed, type = "text")
## 
## ===========================================================================================
##                                               Dependent variable:                          
##                     -----------------------------------------------------------------------
##                               sum                  bi_leader         media_coverage_appear 
##                               (1)                     (2)                     (3)          
## -------------------------------------------------------------------------------------------
## Host_State                 1.491***                1.499***                2.183***        
##                             (0.263)                 (0.260)                 (0.253)        
##                                                                                            
## Leader_or_not              0.874***                0.954***                  0.040         
##                             (0.205)                 (0.203)                 (0.197)        
##                                                                                            
## Constant                   -0.869***               -0.943***                -0.153         
##                             (0.194)                 (0.192)                 (0.187)        
##                                                                                            
## -------------------------------------------------------------------------------------------
## Observations                  199                     197                     199          
## R2                           0.217                   0.236                   0.277         
## Adjusted R2                  0.209                   0.228                   0.270         
## Residual Std. Error    0.847 (df = 196)        0.836 (df = 194)        0.814 (df = 196)    
## F Statistic         27.189*** (df = 2; 196) 30.011*** (df = 2; 194) 37.575*** (df = 2; 196)
## ===========================================================================================
## Note:                                                           *p<0.1; **p<0.05; ***p<0.01
##----------------------------------------------------------------
library(broom)
library(ggplot2)

# Tidy up the regression results using the tidy() function
mulsum_tidy <- tidy(mulsum)
mulbi_tidy <- tidy(mulbi)
mulmed_tidy <- tidy(mulmed)


# model naming
mulsum_tidy$model <- "sum"
mulbi_tidy$model <- "bi_leader"

# Combining mulsum_tidy with mulbi_tidy
combined_tidy <- rbind(mulsum_tidy, mulbi_tidy)

# Plot of sum and bi_leader
ggplot(combined_tidy, aes(x = estimate, y = term, color = model)) +
  geom_point(size = 3, alpha = 0.7, position = position_dodge(width = 0.5)) +
  geom_errorbarh(aes(xmin = estimate - std.error, xmax = estimate + std.error), 
                 height = 0.2, position = position_dodge(width = 0.5)) +
  scale_color_manual(values = c("blue", "red" )) +
  labs(title = "Coefficient Plot for All Models", 
       x = "Coefficient Estimate", 
       y = "Variables") +
  theme_minimal() +
  theme(legend.title = element_blank(), 
        legend.position = "top",
        axis.text.y = element_text(size = 10), 
        axis.text.x = element_text(size = 10), 
        plot.title = element_text(size = 14))

# Plot of media_coverage_appear
ggplot(mulmed_tidy, aes(x = estimate, y = term)) +
  geom_point(size = 3, alpha = 0.7, color = "green") +  
  geom_errorbarh(aes(xmin = estimate - std.error, xmax = estimate + std.error), 
                 height = 0.2) +
  labs(title = "Coefficient Plot for 'media_coverage_appear' Model", 
       x = "Coefficient Estimate", 
       y = "Variables") +
  theme_minimal() +
  theme(axis.text.y = element_text(size = 10), 
        axis.text.x = element_text(size = 10), 
        plot.title = element_text(size = 14))

Results

The next two plot figures are the result of multiple regression analysis with the above variables. First, for H1 (bilateral meetings), the results are significant for both overall meetings and meetings between heads of state. We can see that the attendance of the heads of state increases the number of meetings between heads of state by 1.07. The effect of the host country on the summit meeting was found to be greater than that of the non-host country. This intuitively suggests that the host country will play a leading role in that year’s G20 summit. Next, for H2 (volume of media coverage), there was no impact of the heads of state’s attendance. On the other hand, the impact of the host country on the amount of media coverage was very large. This suggests that the media focuses not on whether or not the attendees are heads of state or not, but on whether or not they are host countries. ## Conclusion So far, we examined the effects generated by the leaders’ attendance at the G20 summit. We found that the attendance of heads of state and government has an impact on the number of bilateral meetings. On the other hand, the attendance of heads of state did not have an effect on the increase or decrease in the amount of media coverage. Rather, it was found that the effect of the host country on the amount of media coverage was greater. However, the reverse causality is also possible. In other words, the advantages and disadvantages that member countries suffer from the attendance (or non-attendance) of heads of state at multilateral meetings are prior, and therefore, member countries may participate in the meetings. There is room for further study on the present study.