library(stats)
library(car)
## Warning: package 'car' was built under R version 4.5.3
## Loading required package: carData
## Warning: package 'carData' was built under R version 4.5.3
library(lmtest)
## Warning: package 'lmtest' was built under R version 4.5.3
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 4.5.3
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(zoo)
data <- read.table(file.choose(), header = TRUE)
data
## Kabupaten IPM IPG
## 1 Pacitan 87.59 72.26
## 2 Ponorogo 95.41 74.65
## 3 Trenggalek 93.64 73.39
## 4 Tulungagung 95.84 75.88
## 5 Blitar 94.35 74.43
## 6 Kediri 94.14 76.09
## 7 Malang 89.82 74.45
## 8 Lumajang 90.30 71.02
## 9 Jember 86.80 71.57
## 10 Banyuwangi 88.31 75.17
## 11 Bondowoso 91.57 71.72
## 12 Situbondo 88.21 71.87
## 13 Probolinggo 87.17 71.65
## 14 Pasuruan 92.06 73.02
## 15 Sidoarjo 95.46 83.35
## 16 Mojokerto 92.85 77.46
## 17 Jombang 91.62 76.37
## 18 Nganjuk 95.08 75.89
## 19 Madiun 93.62 75.47
## 20 Magetan 95.01 77.58
## 21 Ngawi 94.36 74.43
## 22 Bojonegoro 92.56 73.74
## 23 Tuban 89.71 73.15
## 24 Lamongan 90.86 76.81
## 25 Gresik 92.01 79.69
## 26 Bangkalan 88.42 68.15
## 27 Sampang 87.39 67.23
## 28 Pamekasan 88.04 71.64
## 29 Sumenep 83.57 70.54
## 30 Kota_Kediri 96.36 82.71
## 31 Kota_Blitar 98.11 82.03
## 32 Kota_Malang 97.04 85.55
## 33 Kota_Probolinggo 97.52 78.50
## 34 Kota_Pasuruan 98.59 79.52
## 35 Kota_Mojokerto 95.65 82.35
## 36 Kota_Madiun 96.05 85.12
## 37 Kota_Surabaya 95.96 85.65
## 38 Kota_Batu 91.87 80.35
summary(data)
## Kabupaten IPM IPG
## Length:38 Min. :83.57 Min. :67.23
## Class :character 1st Qu.:89.74 1st Qu.:72.45
## Mode :character Median :92.70 Median :75.32
## Mean :92.45 Mean :76.06
## 3rd Qu.:95.45 3rd Qu.:79.27
## Max. :98.59 Max. :85.65
boxplot(data$IPG, data$IPM, names = c("IPG", "IPM"), main = "Boxplot IPG dan IPM", col = "pink")

plot (data$IPM, data$IPG, xlab = "Indeks Pembangunan Manusia (IPM)", ylab = "Indeks Pembangunan Gender", main = "Scatter Plot IPM dan IPG", pch = 19)
abline(lm(IPG ~ IPM, data = data), col = "blue", lwd = 2)

shapiro.test(data$IPM)
##
## Shapiro-Wilk normality test
##
## data: data$IPM
## W = 0.96435, p-value = 0.2621
shapiro.test(data$IPG)
##
## Shapiro-Wilk normality test
##
## data: data$IPG
## W = 0.9572, p-value = 0.1537
cor.test(data$IPM, data$IPG, method = "pearson")
##
## Pearson's product-moment correlation
##
## data: data$IPM and data$IPG
## t = 6.8672, df = 36, p-value = 4.906e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.5707799 0.8645958
## sample estimates:
## cor
## 0.7530543