Eksplorasi dan visualisasi data menggunakan data INDODAPOER yang berhubungan dengan topik “Eksplorasi Hubungan Permasalahan Lingkungan Hidup dengan Wabah Diare di Maluku”. Beberapa variabel diambil dalam rentang waktu 1996-2020 di Provinsi Maluku sebagai berikut.
1. Year
2. Household Access to safe Sanitation (in % of total Household)
3. Household Access to Safe Water (in % of total household)
4. Environment function expenditure (in IDR)
5. Health function expenditure (in IDR)
6. Infrastructure function expenditure (in IDR)
7. Household per capita expenditure (in IDR)
8. Monthly Per Capita Household Health Expenditure (in IDR)
9. Monthly Per Capita TOTAL Household Expenditure for The Poorest 20 percent (in IDR)
10. Morbidity Rate (in %)
11. Total Population (in number of people)

Data dapat didownload di sini.

Input Data

library(readxl)
indodapoer_maluku <- read_xlsx("C:/Users/BANGSIS-1/Downloads/indodapoer_maluku.xlsx")

Eksplorasi Data

dim(indodapoer_maluku)
## [1] 25 11
indodapoer_maluku <- as.data.frame(apply(indodapoer_maluku, 2, as.numeric))
sapply(indodapoer_maluku, class)  
round(indodapoer_maluku, 2)
str(indodapoer_maluku)
## 'data.frame':    25 obs. of  11 variables:
##  $ Year                                                                              : num  1996 1997 1998 1999 2000 ...
##  $ Household Access to safe Sanitation (in % of total Household)                     : num  35 37.1 37.6 36.8 NA ...
##  $ Household Access to Safe Water (in % of total household)                          : num  45 40.8 46 41.8 NA ...
##  $ Environment function expenditure (in IDR)                                         : num  NA NA NA NA NA ...
##  $ Health function expenditure (in IDR)                                              : num  NA NA NA NA NA ...
##  $ Infrastructure function expenditure (in IDR)                                      : num  NA NA NA NA NA ...
##  $ Household per capita expenditure (in IDR)                                         : num  45574 NA NA 96311 NA ...
##  $ Monthly Per Capita Household Health Expenditure (in IDR)                          : num  515 583 885 957 NA ...
##  $ Monthly Per Capita TOTAL Household Expenditure for The Poorest 20 percent (in IDR): num  23046 27203 32555 50047 NA ...
##  $ Morbidity Rate (in %)                                                             : num  10.7 18.4 17.7 16.5 0 ...
##  $ Total Population (in number of people)                                            : num  1316200 1342000 1368000 1394000 1200070 ...
summary(indodapoer_maluku)
##       Year      Household Access to safe Sanitation (in % of total Household)
##  Min.   :1996   Min.   :35.05                                                
##  1st Qu.:2002   1st Qu.:42.17                                                
##  Median :2008   Median :48.34                                                
##  Mean   :2008   Mean   :51.79                                                
##  3rd Qu.:2014   3rd Qu.:61.52                                                
##  Max.   :2020   Max.   :74.98                                                
##                 NA's   :1                                                    
##  Household Access to Safe Water (in % of total household)
##  Min.   :40.75                                           
##  1st Qu.:49.77                                           
##  Median :55.51                                           
##  Mean   :56.69                                           
##  3rd Qu.:63.08                                           
##  Max.   :73.59                                           
##  NA's   :1                                               
##  Environment function expenditure (in IDR) Health function expenditure (in IDR)
##  Min.   :1.154e+09                         Min.   :3.650e+09                   
##  1st Qu.:2.228e+09                         1st Qu.:5.163e+10                   
##  Median :3.873e+09                         Median :8.151e+10                   
##  Mean   :9.213e+09                         Mean   :1.193e+11                   
##  3rd Qu.:1.046e+10                         3rd Qu.:2.126e+11                   
##  Max.   :5.499e+10                         Max.   :2.692e+11                   
##  NA's   :6                                 NA's   :6                           
##  Infrastructure function expenditure (in IDR)
##  Min.   :2.972e+10                           
##  1st Qu.:7.983e+10                           
##  Median :1.080e+11                           
##  Mean   :1.246e+11                           
##  3rd Qu.:1.669e+11                           
##  Max.   :2.558e+11                           
##  NA's   :14                                  
##  Household per capita expenditure (in IDR)
##  Min.   :  45574                          
##  1st Qu.: 184752                          
##  Median : 388663                          
##  Mean   : 498924                          
##  3rd Qu.: 794268                          
##  Max.   :1083929                          
##  NA's   :4                                
##  Monthly Per Capita Household Health Expenditure (in IDR)
##  Min.   :  515                                           
##  1st Qu.: 2044                                           
##  Median : 5178                                           
##  Mean   : 6451                                           
##  3rd Qu.:10814                                           
##  Max.   :16414                                           
##  NA's   :3                                               
##  Monthly Per Capita TOTAL Household Expenditure for The Poorest 20 percent (in IDR)
##  Min.   : 23046                                                                    
##  1st Qu.: 88483                                                                    
##  Median :183368                                                                    
##  Mean   :197464                                                                    
##  3rd Qu.:320068                                                                    
##  Max.   :459008                                                                    
##  NA's   :3                                                                         
##  Morbidity Rate (in %) Total Population (in number of people)
##  Min.   : 0.00         Min.   :1200070                       
##  1st Qu.:17.68         1st Qu.:1340624                       
##  Median :20.05         Median :1457039                       
##  Mean   :21.23         Mean   :1496474                       
##  3rd Qu.:24.81         3rd Qu.:1657409                       
##  Max.   :36.30         Max.   :1831880                       
##  NA's   :1
head(indodapoer_maluku)
##   Year Household Access to safe Sanitation (in % of total Household)
## 1 1996                                                         35.05
## 2 1997                                                         37.15
## 3 1998                                                         37.61
## 4 1999                                                         36.78
## 5 2000                                                            NA
## 6 2001                                                         36.30
##   Household Access to Safe Water (in % of total household)
## 1                                                    45.02
## 2                                                    40.75
## 3                                                    46.05
## 4                                                    41.82
## 5                                                       NA
## 6                                                    59.24
##   Environment function expenditure (in IDR)
## 1                                        NA
## 2                                        NA
## 3                                        NA
## 4                                        NA
## 5                                        NA
## 6                                        NA
##   Health function expenditure (in IDR)
## 1                                   NA
## 2                                   NA
## 3                                   NA
## 4                                   NA
## 5                                   NA
## 6                                   NA
##   Infrastructure function expenditure (in IDR)
## 1                                           NA
## 2                                           NA
## 3                                           NA
## 4                                           NA
## 5                                           NA
## 6                                           NA
##   Household per capita expenditure (in IDR)
## 1                                  45573.89
## 2                                        NA
## 3                                        NA
## 4                                  96311.34
## 5                                        NA
## 6                                 135305.89
##   Monthly Per Capita Household Health Expenditure (in IDR)
## 1                                                      515
## 2                                                      583
## 3                                                      885
## 4                                                      957
## 5                                                       NA
## 6                                                     1951
##   Monthly Per Capita TOTAL Household Expenditure for The Poorest 20 percent (in IDR)
## 1                                                                              23046
## 2                                                                              27203
## 3                                                                              32555
## 4                                                                              50047
## 5                                                                                 NA
## 6                                                                              67046
##   Morbidity Rate (in %) Total Population (in number of people)
## 1                10.667                                1316200
## 2                18.390                                1342000
## 3                17.688                                1368000
## 4                16.456                                1394000
## 5                 0.000                                1200070
## 6                20.373                                1234359

Histogram

sanitasi <- indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`
hist(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`,
breaks = 5,
main="Household Access to safe Sanitation (in %)",
xlab="Household Access to safe Sanitation (in %)",
col="lightgreen",
freq=F)

Variabel akses rumah tangga terhadap sanitasi layak memiliki distribusi miring ke kanan sehingga menggunakan median sebagai titik pusat, yaitu 48,34.

hist(indodapoer_maluku$`Household Access to Safe Water (in % of total household)`,
breaks = 5,
main="Household Access to Safe Water (in %)",
xlab="Household Access to Safe Water (in %)",
col="lightblue",
freq=F)

Variabel akses rumah tangga terhadap air bersih memiliki 2 puncak atau disebut dengan bimodal.

Boxplot

boxplot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, horizontal = TRUE, col = 'lightgreen', xlab="Household Access to safe Sanitation (in %)")

boxplot(indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, horizontal = TRUE, col = 'lightblue', xlab="Household Access to Safe Water (in %)")

Plot

library(ggplot2)
sanitasi_air <- indodapoer_maluku[, c(1,2,3)]
sanitasi_air <- sanitasi_air[-5,]
sanitasi <- sanitasi_air[,c(1,2)]
colnames(sanitasi) <- c("x", "y")
air <- sanitasi_air[,c(1,3)]
colnames(air) <- c("x", "y")

ggplot(NULL, aes(x, y)) + 
  geom_line(data=sanitasi, col="green") +
  geom_line(data=air, col="blue") +
  theme_classic()

Sanitasi = hijau
Air bersih = biru

Line chart di atas menunjukkan Persentase Akses Rumah Tangga terhadap Sanitasi yang Aman dan Air Bersih untuk setiap tahun dari tahun 1996 ke tahun 2020, kecuali tahun 2000.

Persentase akses RT terhadap sanitasi yang aman sempat mengalami peningkatan yang tinggi yaitu tahun 2002 sebesar 74,98%. Namun, pada tahun berikutnya menurun hingga 41,92%. Pada tahun berikutnya terjadi fluktuasi dengan tren meningkat hingga tahun 2020 sebesar 71,15%.

Persentase akses RT terhadap air bersih sempat mengalami peningkatan pada tahun 2002 sebesar 66,88%. Kemudian terjadi fluktuasi dengan tren meningkat hingga tahun 2020 sebesar 73,58%.

Matriks Korelasi

library(PerformanceAnalytics)
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 
## Attaching package: 'PerformanceAnalytics'
## The following object is masked from 'package:graphics':
## 
##     legend
chart.Correlation(indodapoer_maluku[,-1], histogram = TRUE, pch= 19)

Variabel:
1. Year
2. Household Access to safe Sanitation (in % of total Household)
3. Household Access to Safe Water (in % of total household)
4. Environment function expenditure (in IDR)
5. Health function expenditure (in IDR)
6. Infrastructure function expenditure (in IDR)
7. Household per capita expenditure (in IDR)
8. Monthly Per Capita Household Health Expenditure (in IDR) 9. Monthly Per Capita TOTAL Household Expenditure for The Poorest 20 percent (in IDR)
10. Morbidity Rate (in %)
11. Total Population (in number of people)

Scatter Plot

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, ylab="Household Access to Safe Water",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightgreen", cex = 1.5)
abline(lm(indodapoer_maluku$`Household Access to Safe Water (in % of total household)` ~ indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, data = indodapoer_maluku), col = "green")

Terhadap Sanitasi Layak

par(mfrow = c(3, 3))
plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Environment function expenditure (in IDR)`, ylab="Environment fc. expend",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightgreen", cex = 1.5)
abline(lm(indodapoer_maluku$`Environment function expenditure (in IDR)` ~ indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, data = indodapoer_maluku), col = "green")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Health function expenditure (in IDR)`, ylab="Health fc. expend",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightgreen", cex = 1.5)
abline(lm(indodapoer_maluku$`Health function expenditure (in IDR)` ~ indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, data = indodapoer_maluku), col = "green")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Infrastructure function expenditure (in IDR)`, ylab="Infrastructure fc. expend`",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightgreen", cex = 1.5)
abline(lm(indodapoer_maluku$`Infrastructure function expenditure (in IDR)` ~ indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, data = indodapoer_maluku), col = "green")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Household per capita expenditure (in IDR)`, ylab="Household per capita expenditure `",xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightgreen", cex = 1.5)
abline(lm(indodapoer_maluku$`Household per capita expenditure (in IDR)` ~ indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, data = indodapoer_maluku), col = "green")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Monthly Per Capita Household Health Expenditure (in IDR)`, ylab="Monthly Health Expenditure`",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightgreen", cex = 1.5)
abline(lm(indodapoer_maluku$`Monthly Per Capita Household Health Expenditure (in IDR)` ~ indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, data = indodapoer_maluku), col = "green")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Monthly Per Capita TOTAL Household Expenditure for The Poorest 20 percent (in IDR)`, ylab="Monthly Expenditure The Poorest 20 percent`",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightgreen", cex = 1.5)
abline(lm(indodapoer_maluku$`Monthly Per Capita TOTAL Household Expenditure for The Poorest 20 percent (in IDR)` ~ indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, data = indodapoer_maluku), col = "green")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Morbidity Rate (in %)`, ylab="Morbidity Rate",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightgreen", cex = 1.5)
abline(lm(indodapoer_maluku$`Morbidity Rate (in %)` ~ indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, data = indodapoer_maluku), col = "green")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Total Population (in number of people)`, ylab="Total Population",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightgreen", cex = 1.5)
abline(lm(indodapoer_maluku$`Total Population (in number of people)` ~ indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, data = indodapoer_maluku), col = "green")

Terhadap Air Bersih

par(mfrow = c(3, 3))

plot(indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, indodapoer_maluku$`Environment function expenditure (in IDR)`, ylab="Environment fc. expend",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightblue", cex = 1.5)
abline(lm(indodapoer_maluku$`Environment function expenditure (in IDR)` ~ indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, data = indodapoer_maluku), col = "blue")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Health function expenditure (in IDR)`, ylab="Health fc. expend",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightblue", cex = 1.5)
abline(lm(indodapoer_maluku$`Health function expenditure (in IDR)` ~ indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, data = indodapoer_maluku), col = "blue")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Infrastructure function expenditure (in IDR)`, ylab="Infrastructure fc. expend`",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightblue", cex = 1.5)
abline(lm(indodapoer_maluku$`Infrastructure function expenditure (in IDR)` ~ indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, data = indodapoer_maluku), col = "blue")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Household per capita expenditure (in IDR)`, ylab="Household per capita expenditure `",xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightblue", cex = 1.5)
abline(lm(indodapoer_maluku$`Household per capita expenditure (in IDR)` ~ indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, data = indodapoer_maluku), col = "blue")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Monthly Per Capita Household Health Expenditure (in IDR)`, ylab="Monthly Health Expenditure`",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightblue", cex = 1.5)
abline(lm(indodapoer_maluku$`Monthly Per Capita Household Health Expenditure (in IDR)` ~ indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, data = indodapoer_maluku), col = "blue")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Monthly Per Capita TOTAL Household Expenditure for The Poorest 20 percent (in IDR)`, ylab="Monthly Expenditure The Poorest 20 percent`",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightblue", cex = 1.5)
abline(lm(indodapoer_maluku$`Monthly Per Capita TOTAL Household Expenditure for The Poorest 20 percent (in IDR)` ~ indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, data = indodapoer_maluku), col = "blue")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Morbidity Rate (in %)`, ylab="Morbidity Rate",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightblue", cex = 1.5)
abline(lm(indodapoer_maluku$`Morbidity Rate (in %)` ~ indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, data = indodapoer_maluku), col = "blue")

plot(indodapoer_maluku$`Household Access to safe Sanitation (in % of total Household)`, indodapoer_maluku$`Total Population (in number of people)`, ylab="Total Population",
     xlab = "Household Access to safe Sanitation",
     pch = 19, col = "lightblue", cex = 1.5)
abline(lm(indodapoer_maluku$`Total Population (in number of people)` ~ indodapoer_maluku$`Household Access to Safe Water (in % of total household)`, data = indodapoer_maluku), col = "blue")

Bubble Plot

library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.2 --
## v tibble  3.1.6     v dplyr   1.0.9
## v tidyr   1.2.0     v stringr 1.4.0
## v readr   2.1.2     v forcats 0.5.1
## v purrr   0.3.4     
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::first()  masks xts::first()
## x dplyr::lag()    masks stats::lag()
## x dplyr::last()   masks xts::last()
library(hrbrthemes)
## NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
##       Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
##       if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
library(viridis)
## Loading required package: viridisLite
library(gridExtra)
## 
## Attaching package: 'gridExtra'
## 
## The following object is masked from 'package:dplyr':
## 
##     combine
library(ggplot2)
library(ggrepel)
data.indodapoer <- read_xlsx("C:/Users/BANGSIS-1/OneDrive/Documents/indodapoer300822.xlsx")

pengeluarankesehatan <- data.indodapoer$`Monthly Per Capita Household Health Expenditure (in IDR)`
data.indodapoer %>%
  arrange(desc(pengeluarankesehatan)) %>%
  mutate(country = factor(`Provinces Name`, `Provinces Name`)) %>%
  ggplot( aes(x=`Household Access to safe Sanitation (in % of total Household)`, y=`Household Access to Safe Water (in % of total household)`, size = data.indodapoer$`Monthly Per Capita Household Health Expenditure (in IDR)`, color = `Provinces Name`)) +
    geom_point(alpha=0.7) +
    scale_size(range = c(1.4, 19), name="Pengeluaran Kesehatan") +
    scale_color_viridis(discrete=TRUE, guide="none") +
    theme_ipsum() +
    theme(legend.position="bottom") +
    geom_text_repel(data=data.indodapoer, aes(label=`Provinces Name`), size=2)

Bubble Plot untuk menunjukkan besarnya Monthly Per Capita Household Health Expenditure Maluku sebesar 16413.71 dengan 71.15% akses sanitasi layak dan 73.58% akses air bersih.

morbidity <- data.indodapoer$`Morbidity Rate (in %)`
data.indodapoer %>%
  arrange(desc(morbidity)) %>%
  mutate(country = factor(`Provinces Name`, `Provinces Name`)) %>%
  ggplot( aes(x=`Household Access to safe Sanitation (in % of total Household)`, y=`Household Access to Safe Water (in % of total household)`, size = data.indodapoer$`Morbidity Rate (in %)`, color = `Provinces Name`)) +
    geom_point(alpha=0.7) +
    scale_size(range = c(1.4, 19), name="Morbidity") +
    scale_color_viridis(discrete=TRUE, guide="none") +
    theme_ipsum() +
    theme(legend.position="bottom") +
    geom_text_repel(data=data.indodapoer, aes(label=`Provinces Name`), size=2)

Bubble Plot untuk menunjukkan besarnya Morbidity Rate Maluku sebesar 18.55% dengan 71.15% akses sanitasi layak dan 73.58% akses air bersih.


  1. Statistika dan Sains Data, IPB University, ↩︎