Download Package yang dibutuhkan
## Linking to GEOS 3.13.0, GDAL 3.8.5, PROJ 9.5.1; sf_use_s2() is TRUE
## Loading required package: spData
## To access larger datasets in this package, install the spDataLarge
## package with: `install.packages('spDataLarge',
## repos='https://nowosad.github.io/drat/', type='source')`
##
## 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
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
meng-Import Data yang akan diolah
## Reading layer `Banten_ADMIN_BPS' from data source
## `/Users/M.Fabian.R.D/Desktop/SEMESTER 5/RISET OPERASI/PERTEMUAN 8/[geosai.my.id]Banten_Kab (1)/Banten_ADMIN_BPS.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 8 features and 6 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 105.0998 ymin: -7.016779 xmax: 106.7799 ymax: -5.807418
## Geodetic CRS: WGS 84
## [1] "ADM0_EN"
## [2] "date"
## [3] "validOn"
## [4] "PROVINCE"
## [5] "Kabupaten"
## [6] "PRV2"
## [7] "fasilitas_kesehatan"
## [8] "Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan"
## [9] "geometry"
## vars n mean sd
## fasilitas_kesehatan 1 8 2135.38 1178.71
## Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan 2 8 27.66 10.56
## median trimmed mad
## fasilitas_kesehatan 1855.00 2135.38 1242.42
## Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan 31.46 27.66 10.70
## min max range
## fasilitas_kesehatan 645.00 4252.00 3607.00
## Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan 11.43 40.16 28.73
## skew kurtosis se
## fasilitas_kesehatan 0.42 -1.17 416.74
## Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan -0.38 -1.66 3.73
cor.test(shp_Join$Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan,shp_Join$fasilitas_kesehatan)
##
## Pearson's product-moment correlation
##
## data: shp_Join$Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan and shp_Join$fasilitas_kesehatan
## t = -0.28496, df = 6, p-value = 0.7853
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.7584669 0.6413417
## sample estimates:
## cor
## -0.1155545
membobotkan matriks
##
## Bivariate Moran I_{xy} test under randomisation
##
## data: shp_Join$Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan using rank correction
## weights: lw1
##
## Bivariate Moran Z(I_{xy}) statistic = -0.40601, p-value = 0.6847
## alternative hypothesis: two.sided
## sample estimates:
## Bivariate Moran I_{xy} statistic Expectation
## -0.07205126 0.01650778
## Variance
## 0.04757688
mencari titik centroid data serta menghitung jarak moran
## Warning: st_centroid assumes attributes are constant over geometries
## Warning in mat2listw(w): style is M (missing); style should be set to a valid
## value
##
## Bivariate Moran I_{xy} test under randomisation
##
## data: shp_Join$Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan using rank correction
## weights: lw1
##
## Bivariate Moran Z(I_{xy}) statistic = -0.40601, p-value = 0.6847
## alternative hypothesis: two.sided
## sample estimates:
## Bivariate Moran I_{xy} statistic Expectation
## -0.07205126 0.01650778
## Variance
## 0.04757688
Pembobotan menggunakan KNN
## Warning in knearneigh(longlat, k = 3): k greater than one-third of the number
## of data points
##
## Bivariate Moran I_{xy} test under randomisation
##
## data: shp_Join$Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan using rank correction
## weights: listw
##
## Bivariate Moran Z(I_{xy}) statistic = -0.079212, p-value = 0.9369
## alternative hypothesis: two.sided
## sample estimates:
## Bivariate Moran I_{xy} statistic Expectation
## 0.004791905 0.016507781
## Variance
## 0.021876164
Test Global Bivariate
##
## Bivariate Moran I_{xy} test under randomisation
##
## data: shp_Join$Persentase_Penduduk_yang_Mempunyai_Keluhan_Kesehatan using rank correction
## weights: lw1
##
## Bivariate Moran Z(I_{xy}) statistic = -0.40601, p-value = 0.6847
## alternative hypothesis: two.sided
## sample estimates:
## Bivariate Moran I_{xy} statistic Expectation
## -0.07205126 0.01650778
## Variance
## 0.04757688

Test LISA (Local Bivariate Morans)
Visualisasi data
## [1] "low-high" "high-high"
##
## high-high low-high
## 3 5
## Multiple palettes called "blue" found: "kovesi.blue", "tableau.blue". The first one, "kovesi.blue", is returned.
## Warning: labels do not have the same length as levels, so they are repeated
