Suggested Citation:
Aginta, Harry and Mendez, Carlos (2020). Provincial GDP per capita and Unemployment in Indonesia 1986-2018: An Animated, Automated, and Interactive Exploration in R. R Studio/RPubs. Available at https://rpubs.com/quarcs-lab/okun-indonesia-provinces-1986-2018
This work is licensed under the Creative Commons Attribution-Share Alike 4.0 International License. 
Original data source
Following the standard variables used in analyzing Okun’s law, we use annual data of Income per Capita and Unemployment Rate of 34 Indonesian provinces from 1986 to 2018. The Income per Capita data is calculated by dividing Gross Regional Domestic Product with total population of each province collected from Badan Pusat Statistik (Statistics Indonesia). There are some missing values in our original dataset that resulted from province splitting up process. Therefore, we use interpolation technique to calculate the data for some proliferated provinces. We use linear regression method for interpolation with reference provinces as regressors. As for the unemployment rate, we collect the data for all provinces from Indonesian Ministry of Manpower.
# Select and order variables
Indonesia_province_gdppc_unemp_1986_2018 <- Indonesia_province_gdppc_unemp_1986_2018 %>%
select(
province,
year,
gap_ln_gpd,
gap_unemp,
gdp,
unemp,
ln_gdp,
trend_unemp,
trend_ln_gpd,
c_unemp,
g_gdp,
)
Definitions of variables
| | | |
---|
province | Name of the province in English | cs_id | |
year | Year of data | ts_id | |
gap_ln_gpd | Gap of log of GDPpc | numeric | |
gap_unemp | Gap of unemployment | numeric | |
gdp | Real Gross Domestic Product per capita | numeric | |
unemp | Unemployment rate | numeric | |
ln_gdp | Natural log of GDP per capita | numeric | |
trend_unemp | Trend of unemployment (HP=100) | numeric | |
trend_ln_gpd | Trend of log of GDPpc (HP=100) | numeric | |
c_unemp | Annual change in the unemployment rate | numeric | |
Interactive Table
# Define function for interactive table
create_dt <- function(x){
DT::datatable(x,
extensions = 'Buttons',
options = list(dom = 'Blfrtip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print'),
lengthMenu = list(c(10,25,50,-1),
c(10,25,50,"All"))))
}
Animated exploration
Motivation
Considering the entire 1986-2018 period, a static figure is difficult to interpret

Potential solution
An animated figure convering each year (with smooth interpolations with each year) could be more informative.
QUIZ: What seems to be the predominant relationship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