library(readxl) 
## Warning: package 'readxl' was built under R version 4.4.2
library(GGally) 
## Warning: package 'GGally' was built under R version 4.4.3
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.4.2
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
library(corrplot)
## Warning: package 'corrplot' was built under R version 4.4.3
## corrplot 0.95 loaded
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.4.3
## 
## 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(car)
## Warning: package 'car' was built under R version 4.4.3
## Loading required package: carData
## Warning: package 'carData' was built under R version 4.4.2
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
library(stargazer)
## 
## Please cite as:
##  Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
library(lmtest)
## Warning: package 'lmtest' was built under R version 4.4.3
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 4.4.2
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(olsrr)
## Warning: package 'olsrr' was built under R version 4.4.3
## 
## Attaching package: 'olsrr'
## The following object is masked from 'package:datasets':
## 
##     rivers
dt <- read_xlsx("C:/Users/LENOVO/Downloads/Data Latihan.xlsx")
dt
## # A tibble: 548 × 18
##    No.   `Kabupaten/Kota`   AHH   IKP   IPM   INT      PDRB   PTP     PDP   RLS
##    <chr> <chr>            <dbl> <dbl> <dbl> <dbl>     <dbl> <dbl>   <dbl> <dbl>
##  1 ACEH  <NA>              NA    NA    NA      NA       NA  NA         NA NA   
##  2 1     Simeulue          65.3  72.4  66.0    96  2274362.  1.37     177  9.34
##  3 2     Aceh Singkil      67.4  53.1  68.9    73  2422611.  2.06    5259  8.53
##  4 3     Aceh Selatan      64.4  71.9  67.1   149  5530755.  1.35   19247  8.87
##  5 4     Aceh Tenggara     68.1  74.0  69.4   279  5058529.  2.05    7526  9.66
##  6 5     Aceh Timur        68.7  74.1  67.6   329 10605785.  1.55   16153  8.15
##  7 6     Aceh Tengah       68.8  71.1  73.2   175  7387370.  2.01 1386828  9.85
##  8 7     Aceh Barat        68.0  78.6  71.4   207  8109233.  1.32   20481  9.37
##  9 8     Aceh Besar        69.8  84.0  73.6   457 13329465.  1.4   245664 10.3 
## 10 9     Pidie             66.9   0    70.6   562 10758806.  1.35   89896  8.99
## # ℹ 538 more rows
## # ℹ 8 more variables: TPT <dbl>, AML <dbl>, ASL <dbl>, PPM <dbl>, PKD <dbl>,
## #   PPK <dbl>, HLS <dbl>, PAK <dbl>
str(dt)
## tibble [548 × 18] (S3: tbl_df/tbl/data.frame)
##  $ No.           : chr [1:548] "ACEH" "1" "2" "3" ...
##  $ Kabupaten/Kota: chr [1:548] NA "Simeulue" "Aceh Singkil" "Aceh Selatan" ...
##  $ AHH           : num [1:548] NA 65.3 67.4 64.3 68.1 ...
##  $ IKP           : num [1:548] NA 72.4 53.1 71.9 74 ...
##  $ IPM           : num [1:548] NA 66 68.9 67.1 69.4 ...
##  $ INT           : num [1:548] NA 96 73 149 279 329 175 207 457 562 ...
##  $ PDRB          : num [1:548] NA 2274362 2422611 5530755 5058529 ...
##  $ PTP           : num [1:548] NA 1.37 2.06 1.35 2.05 1.55 2.01 1.32 1.4 1.35 ...
##  $ PDP           : num [1:548] NA 177 5259 19247 7526 ...
##  $ RLS           : num [1:548] NA 9.34 8.53 8.87 9.66 ...
##  $ TPT           : num [1:548] NA 5.47 8.24 6.54 5.72 ...
##  $ AML           : num [1:548] NA 79.8 72.7 80.4 90.9 ...
##  $ ASL           : num [1:548] NA 66.5 64.2 68.8 54 ...
##  $ PPM           : num [1:548] NA 18.5 20.2 12.9 13.2 ...
##  $ PKD           : num [1:548] NA 7085 8707 8089 8020 ...
##  $ PPK           : num [1:548] NA 834617 916757 1021245 935304 ...
##  $ HLS           : num [1:548] NA 13.8 14.3 14.4 14 ...
##  $ PAK           : num [1:548] NA 70.4 62 61.4 71.3 ...
summary(dt)
##      No.            Kabupaten/Kota          AHH             IKP       
##  Length:548         Length:548         Min.   : 0.00   Min.   : 0.00  
##  Class :character   Class :character   1st Qu.:67.22   1st Qu.:67.17  
##  Mode  :character   Mode  :character   Median :69.91   Median :76.16  
##                                        Mean   :69.42   Mean   :70.57  
##                                        3rd Qu.:71.86   3rd Qu.:81.42  
##                                        Max.   :77.65   Max.   :93.32  
##                                        NA's   :34      NA's   :40     
##       IPM             INT              PDRB                PTP        
##  Min.   : 0.00   Min.   :  0.00   Min.   :        0   Min.   :-0.810  
##  1st Qu.:66.34   1st Qu.: 43.25   1st Qu.:  5270653   1st Qu.: 0.760  
##  Median :69.31   Median : 77.50   Median : 11910160   Median : 1.295  
##  Mean   :69.50   Mean   :109.26   Mean   : 30839174   Mean   : 1.414  
##  3rd Qu.:72.86   3rd Qu.:151.00   3rd Qu.: 28083154   3rd Qu.: 1.770  
##  Max.   :86.61   Max.   :562.00   Max.   :700790711   Max.   :12.800  
##  NA's   :34      NA's   :34       NA's   :34          NA's   :34      
##       PDP               RLS              TPT              AML         
##  Min.   :      0   Min.   : 0.000   Min.   : 0.208   Min.   :  2.397  
##  1st Qu.:      0   1st Qu.: 7.433   1st Qu.: 3.663   1st Qu.: 77.525  
##  Median :   8890   Median : 8.240   Median : 4.902   Median : 89.625  
##  Mean   : 174568   Mean   : 8.328   Mean   : 5.552   Mean   : 83.864  
##  3rd Qu.:  63005   3rd Qu.: 9.280   3rd Qu.: 7.014   3rd Qu.: 96.439  
##  Max.   :9797158   Max.   :12.650   Max.   :15.921   Max.   :100.000  
##  NA's   :34        NA's   :34       NA's   :34       NA's   :34       
##       ASL             PPM              PKD             PPK         
##  Min.   : 0.00   Min.   : 2.020   Min.   : 3975   Min.   : 485881  
##  1st Qu.:68.71   1st Qu.: 6.798   1st Qu.: 8568   1st Qu.: 901957  
##  Median :81.35   Median :10.165   Median :10109   Median :1046051  
##  Mean   :75.98   Mean   :12.007   Mean   :10266   Mean   :1143516  
##  3rd Qu.:89.23   3rd Qu.:14.605   3rd Qu.:11620   3rd Qu.:1312207  
##  Max.   :99.41   Max.   :41.760   Max.   :23575   Max.   :2717039  
##  NA's   :34      NA's   :40       NA's   :40      NA's   :40       
##       HLS             PAK       
##  Min.   : 3.61   Min.   :36.65  
##  1st Qu.:12.36   1st Qu.:65.06  
##  Median :12.87   Median :69.19  
##  Mean   :12.95   Mean   :69.18  
##  3rd Qu.:13.60   3rd Qu.:72.26  
##  Max.   :17.79   Max.   :96.25  
##  NA's   :40      NA's   :34
hist(dt$PPM, main = "Sebaran Persentase Penduduk Miskin")

boxplot(dt$PPM, main = "Sebaran Persentase Penduduk Miskin")

plot(dt$IPM, dt$PPM)

plot(dt$RLS, dt$PPM)

plot(dt$PDRB, dt$PPM)