Import Library
1. Data Import and Descriptive Statistics
pdrb_bali <- read_excel("E:/BINTEL/ETS/Pertumbuhan PDRB_Ekonomi Kabupaten_Kota di Provinsi Bali.xlsx")
summary(pdrb_bali)
## Kabupaten 2014 2015 2016
## Length:9 Min. :5.83 Min. :6.000 Min. :5.920
## Class :character 1st Qu.:6.01 1st Qu.:6.110 1st Qu.:6.020
## Mode :character Median :6.53 Median :6.160 Median :6.240
## Mean :6.46 Mean :6.156 Mean :6.243
## 3rd Qu.:6.96 3rd Qu.:6.190 3rd Qu.:6.310
## Max. :7.00 Max. :6.300 Max. :6.810
## 2017 2018 2019 2020
## Min. :5.060 Min. :5.440 Min. :5.420 Min. :-16.550
## 1st Qu.:5.310 1st Qu.:5.480 1st Qu.:5.500 1st Qu.: -8.390
## Median :5.370 Median :5.600 Median :5.560 Median : -6.170
## Mean :5.479 Mean :5.829 Mean :5.586 Mean : -7.367
## 3rd Qu.:5.460 3rd Qu.:6.010 3rd Qu.:5.620 3rd Qu.: -4.980
## Max. :6.080 Max. :6.730 Max. :5.820 Max. : -4.100
## 2021 2022
## Min. :-6.740 Min. :2.580
## 1st Qu.:-1.270 1st Qu.:2.940
## Median :-0.920 Median :3.110
## Mean :-1.526 Mean :4.066
## 3rd Qu.:-0.560 3rd Qu.:4.040
## Max. :-0.230 Max. :9.970
Between 2014-2019, the dataset shows relatively stable trends, with slight fluctuations in the mean values over the years. However, in 2017, there is a noticeable drop, where the minimum and median values decline significantly, suggesting an overall downturn. The most dramatic change occurs in 2020, where the data experiences a sharp decline, turning negative, with a minimum value of -16.550 and a mean of -7.367. This suggests a major disruption, potentially caused by an external event like an economic crisis or the COVID-19 pandemic, which had widespread effects globally. In 2021, signs of recovery begin to appear, but the values remain slightly negative, indicating that while the impact of the crisis was less severe compared to the previous year, full recovery had not yet been achieved. The mean value of -1.526 suggests gradual improvement. By 2022, the dataset reflects a complete rebound, as values shift back into the positive range. The mean increases to 4.066, and the maximum reaches 9.970, signaling significant growth or recovery. This trend suggests resilience, where after a period of decline, there was strong improvement, possibly due to policy interventions, economic adaptations, or renewed stability.
2. Data Transformation (Pivot to Long)
pdrb_new <- pdrb_bali %>%
pivot_longer(
cols = `2014`:`2022`,
names_to = "Tahun",
values_to = "Nilai_PDRB"
)
pdrb_new <- pdrb_new %>% mutate(Tahun = as.numeric(Tahun))
Converting the data into long format makes time series analysis easier because each observation is structured with the year as an independent variable.
3. Boxplot Visualization
a. Each City
ggplot(pdrb_new, aes(x = Kabupaten, y = Nilai_PDRB , fill = Kabupaten)) +
geom_boxplot() +
labs(title = "Distribusi PDRB per Kabupaten (2014–2022)",
x = "Kabupaten",
y = "Nilai PDRB") +
scale_fill_brewer(palette = "Pastel1") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
The visualization compares the distribution of PDRB across nine regencies and cities in Bali over the period 2014–2022. Each boxplot represents the spread of PDRB values for a given district, including the median, interquartile range, and potential outliers (the black dots). Most regencies, such as Badung, Denpasar, and Gianyar, show relatively consistent PDRB distributions with narrow interquartile ranges, indicating stable economic performance. Badung and Denpasar, in particular, appear to have higher median PDRB values compared to others, which is expected as they are economic centers of Bali. On the other hand, regencies like Bangli and Klungkung show lower PDRB values overall. The presence of outliers (black dots) suggests occasional years where the PDRB deviated significantly from the general trend in some districts.
b. Each Year
ggplot(pdrb_new, aes(x = as.factor(Tahun), y = Nilai_PDRB , fill = Kabupaten)) +
geom_boxplot() +
labs(title = "Distribusi PDRB per Tahun",
x = "Tahun",
y = "Nilai PDRB") +
scale_fill_brewer(palette = "Pastel1") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 50, hjust = 1))
The chart illustrates how PDRB values varied over time across Bali’s districts. From 2014 to 2019, the PDRB distribution appears relatively stable, with most values concentrated within a narrow range, indicating consistent economic performance across regions. However, in 2020, there is a notable drop and increased spread in PDRB values — with several outliers and lower median values — suggesting a significant economic disruption, likely due to the COVID-19 pandemic and its impact on tourism and local economies. In 2021 and 2022, there is some sign of recovery, as the values begin to rise and concentrate again, though not yet returning to the pre-2020 levels. This pattern highlights the economic shock of the pandemic and the gradual path toward recovery in the Bali region.
4. Multiple Time Series Plot
ggplot(pdrb_new, aes(x = Tahun, y = Nilai_PDRB, color = Kabupaten)) +
geom_rect(aes(xmin = 2020, xmax = 2021, ymin = -Inf, ymax = Inf),
fill = "pink", alpha = 0.4, inherit.aes = FALSE) +
geom_line(size = 1) +
geom_point() +
geom_vline(xintercept = c(2020, 2021), linetype = 2, color = "red", linewidth = 1) +
labs(title = "Tren PDRB 9 Kabupaten/Kota di Bali (2014–2022)",
subtitle = "Periode COVID-19 (2020–2021) diberi highlight merah muda",
x = "Tahun",
y = "Nilai PDRB",
color = "Kabupaten/Kota") +
theme_minimal()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning in geom_rect(aes(xmin = 2020, xmax = 2021, ymin = -Inf, ymax = Inf), : All aesthetics have length 1, but the data has 81 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
The graph displays the evolution of the Gross Regional Domestic Product (GRDP) for nine regions (or regencies/cities) in Bali between 2014 and 2022. Each region is represented by its own colored line, allowing us to compare how diverse areas such as Badung, Bangli, Buleleng, Gianyar, Jembrana, Karang Asem, Klungkung, Kota Denpasar, and Tabanan have fared over this period.
Pre-Pandemic Trends (2014–2019): Prior to the COVID-19 disruption, the graph likely shows a period of gradual economic growth for many of these regions. This steady climb reflects years of increasing economic activity and could be indicative of factors like growing tourism, infrastructure improvements, and other development initiatives that are typical in Bali.
Impact of COVID-19 (2020–2021): The graph distinctly highlights the COVID-19 period with a shaded gray area. During these years, there is a pronounced and sharp decline in GRDP values across most regions. This drop mirrors the sudden halt in economic activity—especially in tourism-dependent sectors—which hit Bali particularly hard. The visualization starkly indicates how the global health crisis translated into real economic difficulties at the regional level.
Post-Pandemic Recovery (2021–2022): After the downturn, the lines begin to climb again, signaling a recovery in GRDP values. This rebound suggests that as restrictions eased and global conditions improved, Bali’s regions started to regain momentum. However, the pace and degree of recovery might vary from one region to another, hinting at differences in economic resilience. For instance, regions with more diversified economic activities might bounce back more robustly than those heavily reliant on tourism.
Regional Variations: While the overall trend is one of disruption and recovery, the trajectories of the individual regions could offer deeper insights. Some areas, perhaps the more urban or tourism-centric ones like Badung or Kota Denpasar, might have experienced steeper declines due to the heavy impact on tourism, yet they could also show sharper recoveries once travel resumed. In contrast, regions with more mixed or localized economies might have exhibited a less volatile pattern.
5. Visuaization Using Tmap Each Year
geo_bali = st_read("E:/BINTEL/ETS/Bali_ADMIN_BPS.shp")
## Reading layer `Bali_ADMIN_BPS' from data source `E:\BINTEL\ETS\Bali_ADMIN_BPS.shp' using driver `ESRI Shapefile'
## Simple feature collection with 9 features and 6 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 114.4316 ymin: -8.84919 xmax: 115.7125 ymax: -8.061396
## Geodetic CRS: WGS 84
# divide data per year
pdrb_split <- split(pdrb_new, pdrb_new$Tahun)
# make and merge map
maps <- lapply(names(pdrb_split), function(Tahun) {
geo_temp <- geo_bali %>%
left_join(pdrb_split[[Tahun]], by = "Kabupaten")
qtm(geo_temp,
fill = "Nilai_PDRB",
text = "Kabupaten",
title = paste("PDRB Bali - Tahun", Tahun),
fill.title = "Nilai PDRB")
})
##
## ── tmap v3 code detected ───────────────────────────────────────────────────────
## [v3->v4] `qtm()`: migrate the argument(s) related to the legend of the visual
## variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'
## [v3->v4] `qtm()`: migrate the argument(s) related to the legend of the visual
## variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'
## [v3->v4] `qtm()`: migrate the argument(s) related to the legend of the visual
## variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'
## [v3->v4] `qtm()`: migrate the argument(s) related to the legend of the visual
## variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'
## [v3->v4] `qtm()`: migrate the argument(s) related to the legend of the visual
## variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'
## [v3->v4] `qtm()`: migrate the argument(s) related to the legend of the visual
## variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'
## [v3->v4] `qtm()`: migrate the argument(s) related to the legend of the visual
## variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'
## [v3->v4] `qtm()`: migrate the argument(s) related to the legend of the visual
## variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'
## [v3->v4] `qtm()`: migrate the argument(s) related to the legend of the visual
## variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'
maps[[6]]
maps[[7]]
maps[[8]]
maps[[9]]
The series of PDRB maps from 2019 to 2022 illustrates the economic trajectory of Bali’s regencies before, during, and after the COVID-19 pandemic.
In 2019, prior to the pandemic, all regencies in Bali recorded positive PDRB values, generally ranging from 5.4 to 5.9. This indicates a stable economic condition with consistent regional growth. Economic centers such as Kota Denpasar and Badung showed relatively higher PDRB levels, reflecting their roles as tourism and service hubs in the province.
In 2020, the economic impact of the COVID-19 pandemic became apparent. All regions experienced significant contractions in PDRB, with values ranging from -8 to -18. The most severe declines occurred in regions highly dependent on tourism, particularly Kota Denpasar and Badung. This period corresponds to the peak of the pandemic’s economic disruption, with strict travel restrictions and reduced economic activity.
By 2021, the economic decline continued but at a slower rate. PDRB values remained negative, typically between -1 and -8, indicating that while the contraction persisted, some regions began to experience partial stabilization. The data suggest that early recovery efforts, policy responses, or adaptation to the pandemic’s challenges began to mitigate the worst effects.
In 2022, the maps show a marked recovery. All regencies returned to positive PDRB values, ranging from 2 to 10. Economic centers such as Denpasar and Badung once again showed the highest levels of growth, suggesting a rebound in tourism and services. Although the values had not fully reached pre-pandemic levels, the shift into positive territory reflects a general economic recovery across the province.
Overall, the sequence of maps demonstrates the significant economic downturn Bali experienced during the pandemic and the gradual return to growth in the post-pandemic period.