Libraries

suppressWarnings(suppressMessages({
  library(knitr)
  library(kableExtra)
  library(htmltools)
  library(tidyverse)
  library(scales)
  library(ExPanDaR)
}))
knitr::opts_chunk$set(fig.align = 'center')

theme_set(theme_minimal())

# Change the presentation of decimal numbers to 4 and avoid scientific notation
options(prompt="R> ", digits=6, scipen=7)

Import data

dat <- read_csv("https://raw.githubusercontent.com/quarcs-lab/mendez2020-convergence-clubs-code-data/master/assets/dat.csv") 
## Parsed with column specification:
## cols(
##   .default = col_double(),
##   country = col_character(),
##   region = col_character(),
##   hi1990 = col_character(),
##   isocode = col_character()
## )
## See spec(...) for full column specifications.
glimpse(dat)
## Rows: 2,700
## Columns: 29
## $ id            <dbl> 62, 62, 62, 62, 62, 62, 62, 13, 13, 13, 13, 62, 13, 13,…
## $ country       <chr> "Mozambique", "Mozambique", "Mozambique", "Mozambique",…
## $ year          <dbl> 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2004, 2003, 2…
## $ Y             <dbl> 7034, 7743, 6792, 7223, 8194, 7671, 9125, 4936, 4666, 4…
## $ K             <dbl> 6262, 6462, 6592, 6859, 7246, 7734, 8121, 10047, 9311, …
## $ pop           <dbl> 13.37197, 13.71985, 14.20399, 14.77588, 15.36307, 15.91…
## $ L             <dbl> 5.41371, 5.59319, 5.84473, 6.18786, 6.51367, 6.80472, 7…
## $ s             <dbl> 0.996469, 0.982938, 0.969407, 0.955876, 0.942344, 0.928…
## $ alpha_it      <dbl> 0.573771, 0.573771, 0.573771, 0.573771, 0.573771, 0.573…
## $ GDPpc         <dbl> 526.026, 564.365, 478.176, 488.837, 533.357, 482.056, 5…
## $ lp            <dbl> 1299.29, 1384.36, 1162.07, 1167.29, 1257.97, 1127.31, 1…
## $ h             <dbl> 1.34708, 1.34363, 1.34018, 1.33672, 1.33325, 1.32977, 1…
## $ kl            <dbl> 1156.69, 1155.33, 1127.85, 1108.46, 1112.43, 1136.56, 1…
## $ kp            <dbl> 1.123283, 1.198236, 1.030340, 1.053069, 1.130831, 0.991…
## $ ky            <dbl> 0.890247, 0.834560, 0.970554, 0.949605, 0.884306, 1.008…
## $ TFP           <dbl> 203.955, 220.003, 189.115, 194.962, 213.737, 193.199, 2…
## $ log_GDPpc_raw <dbl> 6.26535, 6.33570, 6.16998, 6.19203, 6.27919, 6.17806, 6…
## $ log_lp_raw    <dbl> 7.16958, 7.23299, 7.05796, 7.06244, 7.13725, 7.02759, 7…
## $ log_ky_raw    <dbl> -0.11625594, -0.18085031, -0.02988867, -0.05170874, -0.…
## $ log_h_raw     <dbl> 0.297936, 0.295377, 0.292805, 0.290219, 0.287620, 0.285…
## $ log_tfp_raw   <dbl> 5.31790, 5.39364, 5.24235, 5.27280, 5.36475, 5.26372, 5…
## $ log_GDPpc     <dbl> 6.16375, 6.19572, 6.22795, 6.26104, 6.29544, 6.33144, 6…
## $ log_lp        <dbl> 7.05023, 7.07574, 7.10155, 7.12835, 7.15673, 7.18709, 7…
## $ log_ky        <dbl> -0.129063, -0.130162, -0.131228, -0.132358, -0.133391, …
## $ log_h         <dbl> 0.277040, 0.279689, 0.282389, 0.285233, 0.288339, 0.291…
## $ log_tfp       <dbl> 5.25749, 5.28692, 5.31650, 5.34665, 5.37760, 5.40939, 5…
## $ region        <chr> "Africa", "Africa", "Africa", "Africa", "Africa", "Afri…
## $ hi1990        <chr> "no", "no", "no", "no", "no", "no", "no", "no", "no", "…
## $ isocode       <chr> "MOZ", "MOZ", "MOZ", "MOZ", "MOZ", "MOZ", "MOZ", "BDI",…

Select all variables but id

dat <- dat %>% 
  select(
    -id
  )

Definitions of variables

df_definitions <- read_csv("https://raw.githubusercontent.com/quarcs-lab/mendez2020-convergence-clubs-code-data/master/assets/dat-definitions.csv") 
## Parsed with column specification:
## cols(
##   var_name = col_character(),
##   var_def = col_character(),
##   type = col_character()
## )
df_definitions 
## # A tibble: 28 x 3
##    var_name var_def                              type   
##    <chr>    <chr>                                <chr>  
##  1 country  Standardized country name (from PWT) cs_id  
##  2 year     Year                                 ts_id  
##  3 Y        GDP                                  numeric
##  4 K        Physical Capital                     numeric
##  5 pop      Population                           numeric
##  6 L        Labor Force                          numeric
##  7 s        Years of Schooling                   numeric
##  8 alpha_it Variable Capital Share               numeric
##  9 GDPpc    GDP per capita                       numeric
## 10 lp       Labor Productivity                   numeric
## # … with 18 more rows

Interactive exploration

Initial exploration

# Run it in the console
ExPanD(
  df = dat,
  df_def = df_definitions,
  export_nb_option = TRUE,
  title = "Automatic data exploration",
  abstract = paste("Full sample")
    )

Customized exploration

#customized <- readRDS("ADD_RDSfile.RDS")
# Run it in the console
ExPanD(
  df = dat,
  df_def = df_definitions,
  config_list = customized,
  export_nb_option = TRUE,
  title = "Customized data exploration",
  abstract = paste("Full sample")
    )

END