Problem Definition

In this assignment, we will use the Penn World Table (PWT) dataset to analyze the economic growth and productivity of countries over time. The main focus will be on:

  1. GDP growth across countries.
  2. Comparison of GDP per capita.
  3. Investigation of labor productivity.
  4. Comparison of Employment Rates of all the countries in the year 2017

Loading necessary libraries

# Load necessary libraries
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.4.2
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.2
library(tidyr)
## Warning: package 'tidyr' was built under R version 4.4.2
library(readr)
## Warning: package 'readr' was built under R version 4.4.2
library(readxl)
## Warning: package 'readxl' was built under R version 4.4.2

Loading the Penn World Dataset

# Load Penn World Table data
pwt <- read_excel("C:/Users/sharm/Downloads/pwt100 (1).xlsx", sheet= "Data")

# Check the structure of the dataset
str(pwt)
## tibble [12,810 × 52] (S3: tbl_df/tbl/data.frame)
##  $ countrycode  : chr [1:12810] "ABW" "ABW" "ABW" "ABW" ...
##  $ country      : chr [1:12810] "Aruba" "Aruba" "Aruba" "Aruba" ...
##  $ currency_unit: chr [1:12810] "Aruban Guilder" "Aruban Guilder" "Aruban Guilder" "Aruban Guilder" ...
##  $ year         : num [1:12810] 1950 1951 1952 1953 1954 ...
##  $ rgdpe        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ rgdpo        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pop          : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ emp          : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ avh          : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ hc           : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ ccon         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ cda          : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ cgdpe        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ cgdpo        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ cn           : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ ck           : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ ctfp         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ cwtfp        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ rgdpna       : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ rconna       : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ rdana        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ rnna         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ rkna         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ rtfpna       : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ rwtfpna      : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ labsh        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ irr          : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ delta        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ xr           : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pl_con       : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pl_da        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pl_gdpo      : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ i_cig        : chr [1:12810] NA NA NA NA ...
##  $ i_xm         : chr [1:12810] NA NA NA NA ...
##  $ i_xr         : chr [1:12810] NA NA NA NA ...
##  $ i_outlier    : chr [1:12810] NA NA NA NA ...
##  $ i_irr        : chr [1:12810] NA NA NA NA ...
##  $ cor_exp      : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ statcap      : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ csh_c        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ csh_i        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ csh_g        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ csh_x        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ csh_m        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ csh_r        : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pl_c         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pl_i         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pl_g         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pl_x         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pl_m         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pl_n         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...
##  $ pl_k         : num [1:12810] NA NA NA NA NA NA NA NA NA NA ...

Data Wrangling:

We’ll use dplyr functions like select(), filter(), and mutate() to clean and select relevant data for analysis:-

  1. Selecting relevant columns:
# Select columns for analysis (Real GDP, Population, Capital, Employment, Year, Country)
pwt_selected <- pwt %>%
  select(country, year, rgdpna, pop, emp, ccon, ck) %>%
  filter(!is.na(rgdpna)) # Remove rows with missing Real GDP data
  1. Creating new variables:
# Calculate GDP per capita and labor productivity
pwt_selected <- pwt_selected %>%
  mutate(
    gdp_per_capita = rgdpna / pop,
    labor_productivity = rgdpna / emp
  )

Table Output:

Now we display a summary table showing the GDP per capita and labor productivity for the top 10 countries by GDP in 2017:-

# Summarize GDP per capita and labor productivity for top 10 countries in 2017
top_countries <- pwt_selected %>%
  filter(year == 2017) %>%
  arrange(desc(gdp_per_capita)) %>%
  head(10) %>%
  select(country, gdp_per_capita, labor_productivity)

# Display the table
print(top_countries)
## # A tibble: 10 × 3
##    country              gdp_per_capita labor_productivity
##    <chr>                         <dbl>              <dbl>
##  1 Qatar                       110270.            148549.
##  2 China, Macao SAR             94060.            154146.
##  3 Luxembourg                   90598.            125221.
##  4 Ireland                      86809.            194314.
##  5 Singapore                    81445.            126698.
##  6 Switzerland                  73625.            126486.
##  7 Norway                       69605.            133727.
##  8 Cayman Islands               67363.             97036.
##  9 United Arab Emirates         66384.            111267.
## 10 Brunei Darussalam            64384.            145790.

Visualizing the Data

We’ll create four visualizations using ggplot2

Visualization 1: GDP per capita by country in 2017

Visualization 2: Labor productivity comparison (GDP per person employed) for the top 10 countries

Visualization 3: Time series of GDP per capita for a selection of countries (e.g., US, China, India)

Visualization 4: Employment Rates comparison of all the countries in the year 2017

## 
## Attaching package: 'rnaturalearthdata'
## The following object is masked from 'package:rnaturalearth':
## 
##     countries110
## Linking to GEOS 3.12.2, GDAL 3.9.3, PROJ 9.4.1; sf_use_s2() is TRUE

Summary of Findings:

  1. Top 10 countries by GDP per capita in 2017:
  1. Labor productivity comparison for the top 10 countries in 2017:
  1. GDP per capita over time for the United States, China, and India:
    • The time series plot illustrates clear trends in GDP per capita for the United States, China, and India. The United States shows steady growth, while China and India demonstrate rapid increases, particularly from the 1990s onwards, reflecting their fast-paced economic growth.
    • This indicates the dramatic rise of emerging economies like China and India, which have been catching up with developed economies.
  2. Employment Rates comparison of all the countries in the year 2017:

The visualization highlights the global distribution of employment rates in 2017:

This stark contrast underscores disparities in global labor markets and the need for tailored policy interventions to improve employment conditions in low-performing regions.