CodeX
Published in

CodeX

Correlating Population — Age Median — GDP using Statistical Computing

Exploring incredible stats with data

In this blog, I’ve picked four countries namely India, China, the United States, and Japan. I have compared the Population Distribution and Age Median of these countries and explored how it has an impact on GDP. All the plots and graphs are done with the R programming language.

Population

The world’s total population is 7.8 billion while the sum of these countries' population is 3.2 billion which covers more than 41.03% of the world’s total population. Comparatively, the world’s total GDP is 138 trillion, while the sum up of these countries is 43.93 trillion which wraps up to 31.83% of the world’s total GDP.

Code:

population_bar <- pop %>%
filter(year == 2020) %>%
ggplot(aes(x = country ,y = pop ,fill = country ,label = population)) +
geom_bar(stat = "identity") +
coord_flip() +
xlab("Country") +
ylab("Population (In Billions)") +
ggtitle("Population in 2020") +
geom_text() +
theme_calc()
population_bar
Image by Author

This Bar chart clearly reveals that India and China are in the front-line with a major portion of the World’s Population. This distribution varies with the maneuver and initiatives taken by the respective countries. By seeing the chart, Japan is about to contain their population by taking scrupulous proceedings. On the other hand, India and China are about to have the world’s largest citizenry. Finally, the USA stands in the middle who has neither massive inhabitants nor less populace.

Code:

for_pop <- forecast %>%
ggplot(aes(year ,pib ,color = country)) +
geom_point(size = 3) +
geom_line(size = 2 ,alpha = 0.2) +
xlab("Year") +
ylab("Population (In Billions)") +
ggtitle("Population Distribution Forecast") +
theme_gdocs()
for_pop

Population Forecast

From this graph, we can observe that India will overshadow China’s total population in 2030 and will be standing at rank 1. This is because of the stringent measures taken by the Chinese palatinate. On the other hand, Japan will be over containing the population which leads to depreciation of the populace. The USA will be having a piecemeal growth in total population but it will step down from its rank 3 to rank 4 in 2040. To conclude, China and Japan over contain the population and have a decline in their citizenry, where India will be the marshal of the total population in 2030.

Population Growth Rate

Code:

growth_line <- pop %>%
mutate(growth = growth * 100) %>%
ggplot(aes(year ,growth ,color = country )) +
geom_line() +
geom_point() +
xlab("Year") +
ylab("Growth Rate") +
ggtitle("Growth Rate from 1980 - 2020") +
theme_calc()
growth_line

By seeing this graph we can observe that every country is containing their total population as they have a down rate in their inhabitants. The diminishing rate of India and Japan is comparatively the same and the line structure is predominantly a slope. The growth rate of China was at its peak in 1990 and has a slope line in the rest of the years. Howbeit, the USA is not having a slope line but it has a gradual decline in growth rate. The United States started containing its population from 2010 as we can observe a diminution in the chart. By statistical scrutinizing, the growth rate of India was at its crest in 1980 with a rate of 2.33%. If India didn’t take any initiatives at that time the total population will be 1.79 billion now, but India took unerring proceedings and contained the total residents to 1.3 billion now. On the contrary, Japan over contained its populace which led to a pessimistic growth rate.

Population Growth Rate Projection

Code:

for_growth_rate <- forecast %>%
mutate(growth = growth * 100) %>%
ggplot(aes(x=year ,y=growth ,fill = country)) +
geom_bar(stat = "identity") +
xlab("Year") +
ylab("Growth Rate") +
ggtitle("Growth Rate Projection") +
facet_wrap(~country) +
theme_calc()
for_growth_rate

To be explicit, the growth rate of China in 2020 is 0.4% and the rate will be jaundiced after 2030 because of the meticulous containment of the growth rate. Because of the resisting rate, the population rank of China will be abdicated to rank 2. Coming to India, it has a healthy growth rate when compared to others. Despite having a decline in growth rate it stood positive till 2050. So, we can say that India has monumental human capital in the year 2050 and will be taking the spot of China. The same case is associated with the United States. The growth rate of the US has gingerly abated over the years but comparatively stood positive like India. The bizarre case among this is Japan as it has persistently a denial growth rate as we can observe from the chart. This is because of over containing the growth rate. It has a systematic decrease in rate over the years and by the end of 2050, the growth rate will be reported at -0.5%. Because of this reason, the median age of Japan is constantly increasing over the years.

Median Age

Actual Median Age of countries from 1980–2020 :

Code:

median_age <- pop %>%
ggplot(aes(year ,medianage ,color = country)) +
geom_point() +
geom_line() +
xlab("Year") +
ylab("Median Age") +
ggtitle("Median Age of Countries") +
theme_calc()
median_age

Projected Median Age of countries from 2020–2050 :

Code:

for_medianage <- forecast %>%
filter(year %in% c(2020 ,2030 ,2040 ,2050)) %>%
ggplot(aes(year ,medianage ,color = country )) +
geom_point(size = 2) +
geom_line() +
xlab("Year") +
ylab("Median Age") +
ggtitle("Median Age Projection") +
theme_calc()
for_medianage

From these graphs, we can notice that India has persistently maintained it’s Median Age starting from 20 in 1980 and managed to be at 28 in 2020. Even when forecasting, the median age of India will be just 38 years in 2050. So, we can say that India has ideally and constructively maintained it’s Median Age over the years. It is attainable for India as it has a positive growth rate. Coming next, the rival of India is China who was able to sustain their median age up to 1990 but appeared to be showing a radical increase in the following years. The median age of China intersects the median age of the USA in 2020 with 38 years. When forecasting the median age of China it revealed a substantial increase with 47 years in 2050 mainly because of its negative growth rate of population. When coming to the USA it does not show any peculiar movements in its median age when compared to other countries. The median age of the USA was at its peak in 2020 with 38 years correlating with China. Howbeit, the USA set to manage the median age and is steadily increasing with corresponding to the positive growth rate of the citizenry. The projected median age of the USA in 2050 will be 42 which is relatively satisfactory when collating to China. Finally, the anomalous case among this is Japan whose median age is far-reaching when compared to the rest. The median age of Japan in 1980 was 32 and was constantly escalating over the years with a peak median age of 48 in 2020 concerning the negative growth rate of the population in Japan. When forecasting the median age of Japan, it spirals to 54 years in 2050. To conclude, India is recognized as the youngest country with respect to its median age and, the oldest country among these is Japan. These median ages correlate with their respective GDP of the country. Read further to know about the correlation between median ages and the GDP of a country.

GDP

GDP of India :

Code:

gdp_1 <- gdp %>%
ggplot(aes(Year ,gdpn1)) +
geom_bar(stat = "identity" ,fill = "blue") +
geom_point(color = "orange" ,size = 3) +
xlab("Year") +
ylab("GDP (In Trillions)") +
ggtitle("Nominal GDP of India") +
theme_hc()
gdp_1

GDP Growth Rate of India : (The horizontal line passes through is the mean of the growth rate of Indian GDP)

Code:

gdp_growth <- gdp %>%
ggplot(aes(Year ,growth)) +
geom_line(size = 1 ,color = "grey") +
geom_point(color = "orange" ,size = 2) +
geom_hline(yintercept = avg_gdpg ,color = "blue",size = 1) +
xlab("Year") +
ylab("Growth Rate") +
ggtitle("Growth Rate of Nominal GDP in India") +
theme_clean()
gdp_growth

The GDP of India according to 2020 is 3.1 trillion dollars. As we can observe from the growth rate chart, it follows a pessimistic trend right from the beginning of 2016. Because of this pandemic bout, the International Monetary Fund reported that the growth rate of Indian GDP will be 2.50% in 2021. On the contrary, the vision of the 5 trillion plan stated by the Prime Minister of India is optimistic to be attained in 2025. This vision of 5 trillion in 2025 can be reached only by obtaining a growth rate of 12.65% per year from 2022 to 2025. But, with an average growth rate of 6.5%, it is possible to accomplish the goal only in 2029. With its huge workforce and the aspects of positive Population growth rate and Age Median, India hopes for the best out of it.

Full Code:

population_bar <- pop %>%
filter(year == 2020) %>%
ggplot(aes(x = country ,y = pop ,fill = country ,label = population)) +
geom_bar(stat = "identity") +
coord_flip() +
xlab("Country") +
ylab("Population (In Billions)") +
ggtitle("Population in 2020") +
geom_text() +
theme_calc()
population_bar
for_pop <- forecast %>%
ggplot(aes(year ,pib ,color = country)) +
geom_point(size = 3) +
geom_line(size = 2 ,alpha = 0.2) +
xlab("Year") +
ylab("Population (In Billions)") +
ggtitle("Population Distribution Forecast") +
theme_gdocs()
for_pop
growth_line <- pop %>%
mutate(growth = growth * 100) %>%
ggplot(aes(year ,growth ,color = country )) +
geom_line() +
geom_point() +
xlab("Year") +
ylab("Growth Rate") +
ggtitle("Growth Rate from 1980 - 2020") +
theme_calc()
growth_line
for_growth_rate <- forecast %>%
mutate(growth = growth * 100) %>%
ggplot(aes(x=year ,y=growth ,fill = country)) +
geom_bar(stat = "identity") +
xlab("Year") +
ylab("Growth Rate") +
ggtitle("Growth Rate Projection") +
facet_wrap(~country) +
theme_calc()
for_growth_rate
median_age <- pop %>%
ggplot(aes(year ,medianage ,color = country)) +
geom_point() +
geom_line() +
xlab("Year") +
ylab("Median Age") +
ggtitle("Median Age of Countries") +
theme_calc()
median_age
for_medianage <- forecast %>%
filter(year %in% c(2020 ,2030 ,2040 ,2050)) %>%
ggplot(aes(year ,medianage ,color = country )) +
geom_point(size = 2) +
geom_line() +
xlab("Year") +
ylab("Median Age") +
ggtitle("Median Age Projection") +
theme_calc()
for_medianage
gdp_1 <- gdp %>%
ggplot(aes(Year ,gdpn1)) +
geom_bar(stat = "identity" ,fill = "blue") +
geom_point(color = "orange" ,size = 3) +
xlab("Year") +
ylab("GDP (In Trillions)") +
ggtitle("Nominal GDP of India") +
theme_hc()
gdp_1
gdp_growth <- gdp %>%
ggplot(aes(Year ,growth)) +
geom_line(size = 1 ,color = "grey") +
geom_point(color = "orange" ,size = 2) +
geom_hline(yintercept = avg_gdpg ,color = "blue",size = 1) +
xlab("Year") +
ylab("Growth Rate") +
ggtitle("Growth Rate of Nominal GDP in India") +
theme_clean()
gdp_growth

--

--

--

Everything connected with Tech & Code. Follow to join our 900K+ monthly readers

Recommended from Medium

AI-Powered: Fashion in Video

Podcast episode: Datatopics: The Data Mesh I — by Tour de Tools

Statistical Significance Is Dying — And Data Science Is To Blame

LSTM for Predictive Maintenance on Pump Sensor Data

Reflexivity in Time Series

Making neural networks solve tougher problems by “thinking” for longer!

Learn to Code the Conservative Way

Machine Learning in PySpark — Part 4

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nikhil Adithyan

Nikhil Adithyan

Founder @CodeX (medium.com/codex), a medium publication connected with code and technology | Top Writer | Connect with me on LinkedIn: https://bit.ly/3yNuwCJ

More from Medium

Calculate your own Inflation Rate

Sentiment Analysis on News Headlines and Stock Price Changes

Stock holdings analysis

An image with the phrase Knowledge is Power, with the words Knowledge and Power crossed out and replaced by Data and Money, creating the new phrase Data is Money.

Stock & Crypto Price Predictions with Machine Learning: How to Approach Building “the Model”