Using Data Science to Visualize Nominal GDP, Growth Rates, & GDP Per Capita to Forecast Ukraine's Economy

header

Data analytics from the previous post forecasts Ukraine’s total population is expected to gradually decline over the next few decades; a trajectory in line with its population trend since its independence in the early 1990s. The visualizations demonstrate that the older population segment (65+ years old) remains steady while the younger and middle age segments are in a decline paralleling the overall pace of decline.

With the population trajectory considered, this post will perform data analysis, analytics, and visualizations for three additional economic indicators such as nominal gross domestic product (GDP), and GDP per capita, and compare Ukraine’s real GDP growth against similar geographic and economic blocs of countries.

To begin, we are going to start a dataset from the World Bank’s data portal which tracks the number of economic indicators. I decided to take a different approach to visualization for our final post. Previously, I used Matplotlib to produce static graphics from Excel sheets. This technique works well due to Matplotlib’s robust features and graphic styles. This time, however, I chose to use Plot.ly, another Python library that offers more interactive features than Matplotlib.

import plotly.plotly as py
import plotly.graph_objs as go
import plotly.figure_factory as ff
import pandas as pd
import numpy as np
xls = pd.ExcelFile("Transposed GDP Current prices.xlsx")
gdp = pd.read_excel(xls, "Sheet1")
future_gdp = pd.read_excel(xls, "Sheet2")
gdp_pc = pd.read_excel("Transposed GDP per capita USD.xlsx")
table = ff.create_table(gdp)


trace_ukraine = go.Scatter(
    x = gdp.Year,
    y = gdp.Ukraine,
    mode = 'lines',
    name = "Ukraine",
) 
trace_ukraine_future = go.Scatter(
    x = future_gdp.Year,
    y = future_gdp.Ukraine,
    showlegend=False,
    name = "Projected Ukraine",
    mode = "lines",
    line = dict(
    color = ("#1F77B4"),
    dash = "dot"
        )
)
trace_beralus = go.Scatter(
       x = gdp.Year,
    y = gdp.Belarus,
    mode = 'lines',
    name = "Belarus"
)   
trace_belarus_future = go.Scatter(
    x = future_gdp.Year,
    y = future_gdp.Belarus,
    showlegend=False,
    name = "Projected Belarus",
    mode = "lines",
    line = dict(
    color = ("#2CA02C"),
    dash = "dot"
     ) 
)
trace_latvia = go.Scatter(
    x = gdp.Year,
    y = gdp.Latvia,
    mode = 'lines',
    name = "Latvia"
)   
trace_latvia_future = go.Scatter(
    x = future_gdp.Year,
    y = future_gdp.Latvia,
    showlegend=False,
    name = "Projected Latvia",
    mode = "lines",
    line = dict(
    color = ("#9467BD"),
    dash = "dot"
    ) 
)
trace_kazakhstan = go.Scatter(
    x = gdp.Year,
    y = gdp.Kazakhstan,
    mode = 'lines',
    name = "Kazakhstan"
) 
trace_kazakhstan_future = go.Scatter(
    x = future_gdp.Year,
    y = future_gdp.Kazakhstan,
    showlegend=False,
    name = "Projected Kazakhstan",
    mode = "lines",
    line = dict(
    color = ("#FF7F0E"),
    dash = "dot"
    ) 
)
trace_uzbekistan = go.Scatter(
    x = gdp.Year,
    y = gdp.Uzbekistan,
    mode = 'lines',
    name = "Uzbekistan"
)
trace_uzbekistan_future = go.Scatter(
    x = future_gdp.Year,
    y = future_gdp.Uzbekistan,
    showlegend=False,
    name = "Projected Uzbekistan",
    mode = "lines",
    line = dict(
    color = ("#8C564B"),
    dash = "dot"
)
)

data = [trace_ukraine, trace_kazakhstan, trace_beralus,                 trace_belarus_future, trace_latvia, trace_uzbekistan, 
    trace_ukraine_future, trace_uzbekistan_future,                         trace_kazakhstan_future, trace_latvia_future]

layout = go.Layout(title="Nominal GDP in US Dollars, 1994 -             2023", xaxis=dict(title='Year'), yaxis=dict(title='GDP in US        Dollars (in billions)'))

fig = go.Figure(data=data, layout=layout)

py.iplot(fig, filename='Real_GDP')
Real_GDP

The graph above visualizes the change in nominal GDP from 1994 to 2018 using figures from the IMF’s dataset as well as their projection for 2023. This graph appears to show Ukraine is doing relatively well compared to four other former Soviet Union countries. The plot, however, is insignificant without considering the population. Ukraine has the second largest population of the fifteen former USSR countries with the notable exception of Russia; an extreme outlier among the group in terms of population and GDP.

Ukraine’s population is self-reported to be slightly under 45 million as of 2018. Self-reported population data is often the source used by international entities such as the World Bank and International Monetary Fund. Ukraine’s closest categorical rival, Uzbekistan has a population of approximately 32 million, however, Ukraine’s nominal GDP handily outperforms the latter. In addition to Russia, Kazakhstan’s GDP is the only one to outperform Ukraine. While Kazakhstan and Ukraine’s GDPs were briefly similar in 2009, the former has experienced a considerably stronger GDP with less than half of the population at 18 million as of 2018.

trace_ukraine = go.Scatter(
    x = gdp_pc.Year,
    y = gdp_pc.Ukraine,
    name = "Ukraine",
    mode = "none",
    fillcolor = ("#cce6ff"),
    fill = "tonexty"
) 
trace_beralus = go.Scatter(
    x = gdp_pc.Year,
    y = gdp_pc.Belarus,
    mode = "none",
    name = "Belarus",
    fill="tonexty",
    fillcolor = ("#66c2ff")
)   
trace_latvia = go.Scatter(
    x = gdp_pc.Year,
    y = gdp_pc.Latvia,
    name = "Latvia",
    mode = "none",
    fill = "tonexty",
    fillcolor = ("#0099ff")
)   
trace_kazakhstan = go.Scatter(
    x = gdp_pc.Year,
    y = gdp_pc.Kazakhstan,
    mode = "none",
    name = "Kazakhstan",
    fill = "tonexty", 
    fillcolor = ("#007acc")

) 
trace_russia = go.Scatter(
    x = gdp_pc.Year,
    y = gdp_pc.Russia,
    name = "Russia"

)
trace_EE = go.Scatter(
    x = gdp_pc.Year,
    y = gdp_pc.Eastern_Europe,
    mode = 'lines+markers',
    name = "Eastern Europe",
    line = dict(
    color = ("#cccccc"),
    width = 4
    )
)
trace_EDE = go.Scatter(
    x = gdp_pc.Year,
    y = gdp_pc.Emerging_and_Developing_Europe,
    mode = 'lines+markers',
    name = "Emerging and Developing Europe",
    line = dict(
       color = ("#000000"),
    width = 4
        )
)

layout = go.Layout(title="GDP Per Capita, 1993 - 2023",
    xaxis=dict(title='Year'),
    yaxis=dict(title='GDP Per Capita in US Dollars (2018)'))

data = [trace_ukraine, trace_beralus, trace_latvia,                   trace_kazakhstan, trace_EE, trace_EDE]

fig = go.Figure(data=data, layout=layout)

py.iplot(fig, filename = "filled_plots")
filled_plots

GDP per capita is the simple equation of dividing nominal GDP by population. This number measures rates at which residents produce economic output. If the sheer economic production of a country were the sole unit for the measure, Ukraine’s economy would be the second most robust among the former USSR.

With the individual output of each resident considered, Latvia, a member state of the European Union and NATO, easily outperforms its rivals. Emerging and Developing Europe above refers to an IMF economic benchmark which includes countries such as Albania, Hungary, and Turkey. The Eastern Europe label refers to the geographic block of countries such as Bulgaria, Lithuania, Poland, and Serbia. While these groups have performed comparably, the GDP per capita of the additional former USSR countries have performed below this threshold and are predicted to do the same for the next five years.

gdp_change = pd.read_excel("Transposed Real GDP Growth.xlsx")

trace_Ukraine = go.Scatter(
    x = gdp_change.Year,
    y = gdp_change.Ukraine,
    mode = 'lines',
    name = "Ukraine",
       line=dict(
    shape='spline'
)

)

trace_World = go.Scatter(
    x = gdp_change.Year,
    y = gdp_change.World,
    mode = 'lines',
    name = "World",
    line=dict(
    shape='spline'
    )
)

trace_Eastern_Europe = go.Scatter(
    x = gdp_change.Year,
    y = gdp_change.Eastern_Europe,
    mode = 'lines',
    name = "Eastern Europe",
    line=dict(
    shape='spline'
)

)

trace_Emerging_Developing_Europe = go.Scatter(
    x = gdp_change.Year,
    y = gdp_change.Emerging_and_Developing_Europe,
    mode = 'lines',
    name = "Emerging and Developing Europe",
    line=dict(
    shape='spline'
)

)

trace_European_Union = go.Scatter(
    x = gdp_change.Year,
    y = gdp_change.European_Union,
    mode = 'lines',
    name = "European_Union",
    line=dict(
    shape='spline'
)

)

layout = go.Layout(title="Annual Change in Real GDP",
    xaxis=dict(title='Year'),
    yaxis=dict(title='Annual Percentage'))

data = [trace_Eastern_Europe, trace_Emerging_Developing_Europe,         trace_European_Union, trace_Ukraine, trace_World]

fig = go.Figure(data=data, layout=layout)

py.iplot(fig, filename = "filled_plots2")
filled_plots2

To conclude this series of posts looking at the future of Ukraine’s economic future, I wanted to create one last chart tracking GDP growth since the early 1990s. Real GDP is the annual sum of all goods and services produced by a particular economy over a given year. This figure takes into account changes in inflation.

Several countries in Eastern Europe were struggling economically after the collapse of the Soviet Union including the Baltic states, Moldova, and Belarus. This group is roughly represented by the Eastern Europe label on the chart above. While Ukraine’s economy was struggling the most amongst this group, it started to experience an upturn along with the rest of its neighbors.

Most of the world’s economies experienced a downturn during the 2008 recession, and this was particularly true of Ukraine. It was, however, able to implement economic reforms and subsequently saw rapid GDP growth from 2009 to 2011. Its economy experienced another significant downturn with the onset of the Euromaidan movement and the annexation of Crimea in 2014 and into 2015. It was again able to take corrective actions under a new president to stabilize its economy and obtain annual growth rates on par with the rest of the world and constituent nation groups.

This series of posts showed us Ukraine will be facing significant economic hurdles in the years and decades ahead. Chief among these hurdles is the expansion of a pension-age class and a dwindling population under 65 years of age. While Ukraine’s GDP is increasing and projected to rise by the IMF, its populace continues to suffer from a low GDP per capita. This outlook can likely become grimmer if the country does not take corrective action for its looming colossal population shift.

In Conclusion

Data science allows us to transform data, often unstructured and sometimes esoteric into a visual representation that results in a comprehensible visualization for storytelling. This series of posts aimed to demonstrate the practical and real-world application of data science. We started by identifying our problem; the future of Ukraine’s economy. We then located available data sources which came in the form of Excel spreadsheets from freely-available portals.

In our case, the data was already mostly structured and only required minor transformations in Excel to be easily read by Pandas. Due to the relatively narrow scope of this application, exploration data analysis (EDA) was minimally required.

Finally, after data wrangling was finished and our data was in a usable format, we used two freely-available Python packages, Matplotlib and Plot.ly to create models, or visualizations to obtain insights.

Comments