library(dplyr)
In this project, we will classify the covid data based on information available. Firstly, we will import and have a look at the data set
covid <- readxl::read_xlsx("dataset/covid_LBB.xlsx")
In this step, we will explore our data
covid |> head(3)
## # A tibble: 3 × 17
## Kecamatan lansia disab…¹ kepad…² pendu…³ pendi…⁴ RS_co…⁵ rasio…⁶ WNA RS
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 CAKUNG 6.22 0.0301 96231 8.76 0.398 1 35 0.00576 1
## 2 CEMPAKA … 10.9 0.0103 71886 13.6 0.294 5 39.7 0.0537 2
## 3 CENGKARE… 6.59 0.149 124663 19.6 0.456 1 39.2 0.0180 1
## # … with 7 more variables: tenaga_kesehatan <dbl>, apotek <dbl>,
## # puskesmas <dbl>, balita <dbl>, positif_cov <dbl>, rawat_cov <dbl>,
## # isoman_cov <dbl>, and abbreviated variable names ¹disabilitas,
## # ²kepadatan_penduduk, ³penduduk_nonmuslim, ⁴pendidikan_rendah, ⁵RS_covid,
## # ⁶rasio_ketergantungan
summary(covid)
## Kecamatan lansia disabilitas kepadatan_penduduk
## Length:44 Min. : 5.873 Min. :0.01019 Min. : 11877
## Class :character 1st Qu.: 7.844 1st Qu.:0.02388 1st Qu.: 87832
## Mode :character Median : 8.845 Median :0.03287 Median :123268
## Mean : 8.997 Mean :0.05443 Mean :144509
## 3rd Qu.: 9.776 3rd Qu.:0.04140 3rd Qu.:167995
## Max. :13.219 Max. :0.38417 Max. :596126
## penduduk_nonmuslim pendidikan_rendah RS_covid rasio_ketergantungan
## Min. : 0.04063 Min. :0.2687 Min. :0.000 Min. :35.00
## 1st Qu.: 9.05234 1st Qu.:0.3334 1st Qu.:1.000 1st Qu.:39.26
## Median :12.11404 Median :0.3501 Median :2.000 Median :39.77
## Mean :16.59378 Mean :0.3751 Mean :2.159 Mean :39.89
## 3rd Qu.:19.81415 3rd Qu.:0.4014 3rd Qu.:3.000 3rd Qu.:40.36
## Max. :50.68831 Max. :0.5982 Max. :5.000 Max. :47.33
## WNA RS tenaga_kesehatan apotek
## Min. :0.000000 Min. :0.000 Min. : 100 Min. : 0.00
## 1st Qu.:0.007346 1st Qu.:1.000 1st Qu.:1251 1st Qu.: 39.00
## Median :0.035313 Median :1.500 Median :1433 Median : 48.00
## Mean :0.049053 Mean :1.818 Mean :1434 Mean : 52.27
## 3rd Qu.:0.068665 3rd Qu.:3.000 3rd Qu.:1614 3rd Qu.: 64.75
## Max. :0.206289 Max. :7.000 Max. :2906 Max. :121.00
## puskesmas balita positif_cov rawat_cov
## Min. : 3.00 Min. : 3.816 Min. : 242 Min. : 0.00
## 1st Qu.: 6.00 1st Qu.: 5.583 1st Qu.: 5698 1st Qu.: 49.75
## Median : 7.50 Median : 6.496 Median : 7966 Median : 62.50
## Mean : 7.75 Mean : 9.139 Mean : 7587 Mean : 65.61
## 3rd Qu.: 9.25 3rd Qu.: 8.814 3rd Qu.: 9622 3rd Qu.: 77.00
## Max. :14.00 Max. :51.532 Max. :14329 Max. :142.00
## isoman_cov
## Min. : 0.00
## 1st Qu.: 41.75
## Median : 62.50
## Mean : 67.93
## 3rd Qu.: 88.50
## Max. :175.00
based on the summary above, we can see that:
there are 44 sub-districts on the data.
there is a possibility of standard deviation in column kepadatan penduduk, WNA, RS, and balita as the max value is more than the twice value of each mean.
glimpse(covid)
## Rows: 44
## Columns: 17
## $ Kecamatan <chr> "CAKUNG", "CEMPAKA PUTIH", "CENGKARENG", "CILANDA…
## $ lansia <dbl> 6.217495, 10.852327, 6.585898, 9.310706, 5.975218…
## $ disabilitas <dbl> 0.03013983, 0.01034276, 0.14911626, 0.02100348, 0…
## $ kepadatan_penduduk <dbl> 96231, 71886, 124663, 64898, 134303, 84663, 98094…
## $ penduduk_nonmuslim <dbl> 8.75538398, 13.63898585, 19.55638163, 9.77313475,…
## $ pendidikan_rendah <dbl> 0.3984311, 0.2939110, 0.4557412, 0.3270238, 0.476…
## $ RS_covid <dbl> 1, 5, 1, 2, 3, 1, 3, 2, 2, 2, 3, 3, 1, 4, 3, 3, 4…
## $ rasio_ketergantungan <dbl> 35.00000, 39.66667, 39.16667, 38.40000, 43.00000,…
## $ WNA <dbl> 0.005758871, 0.053748730, 0.018045530, 0.12941885…
## $ RS <dbl> 1, 2, 1, 3, 1, 0, 1, 2, 1, 3, 3, 2, 0, 1, 3, 2, 4…
## $ tenaga_kesehatan <dbl> 1503, 2027, 2038, 1414, 1396, 1399, 1399, 1545, 1…
## $ apotek <dbl> 62, 47, 121, 39, 64, 56, 60, 60, 36, 110, 31, 69,…
## $ puskesmas <dbl> 9, 4, 10, 6, 10, 11, 6, 12, 4, 10, 6, 12, 7, 13, …
## $ balita <dbl> 4.285196, 7.437936, 3.815583, 5.903733, 5.542494,…
## $ positif_cov <dbl> 11740, 4998, 13036, 8201, 7899, 10437, 9529, 1432…
## $ rawat_cov <dbl> 82, 50, 109, 62, 73, 63, 73, 139, 25, 67, 80, 55,…
## $ isoman_cov <dbl> 102, 17, 146, 114, 63, 124, 108, 145, 42, 43, 175…
from the glimpse we can see that all data has already an approriate type
anyNA(covid)
## [1] FALSE
there is no missing value on our data
anyDuplicated(covid)
## [1] 0
No duplicated data
library(GGally)
ggcorr(covid, label = T, label_size = 2)
with the assumption that above 0.85 as the threshold for extreme correlation, we don’t have the multicollinearity on our data. Hence, the assumption of multicollinearity is fulfilled.
covid_cor <- cor(covid[,2:17])
library(psych)
covid_MSA <- KMO(covid_cor)
covid_MSA
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = covid_cor)
## Overall MSA = 0.56
## MSA for each item =
## lansia disabilitas kepadatan_penduduk
## 0.42 0.33 0.43
## penduduk_nonmuslim pendidikan_rendah RS_covid
## 0.26 0.47 0.57
## rasio_ketergantungan WNA RS
## 0.78 0.45 0.64
## tenaga_kesehatan apotek puskesmas
## 0.44 0.65 0.69
## balita positif_cov rawat_cov
## 0.60 0.69 0.74
## isoman_cov
## 0.71
for KMO (overall MSA) the value is greater than 0.5. So, we can conduct factor analysis on our data. However, there are variables that are under 0.5. before we conduct our factor analysis, let’s first exclude the data which has the MSA under 0.5
covid2 <-
covid |>
select(c("Kecamatan","RS_covid", "rasio_ketergantungan", 'RS', "apotek", "puskesmas", "balita", "positif_cov", "rawat_cov", "isoman_cov"))
dim(covid2)
## [1] 44 10
bartlett.test(covid2[,c(2:10)])
##
## Bartlett test of homogeneity of variances
##
## data: covid2[, c(2:10)]
## Bartlett's K-squared = 3389.7, df = 8, p-value < 0.00000000000000022
Since the p-value returning the value less than 0.05, it means that our data is homogen or difference from one to another
covid_cor2 <- cor(covid2[,c(2:10)])
covid_fa <- fa(covid_cor2)
covid_fa
## Factor Analysis using method = minres
## Call: fa(r = covid_cor2)
## Standardized loadings (pattern matrix) based upon correlation matrix
## MR1 h2 u2 com
## RS_covid 0.24 0.059 0.941 1
## rasio_ketergantungan -0.35 0.121 0.879 1
## RS 0.36 0.127 0.873 1
## apotek 0.57 0.324 0.676 1
## puskesmas 0.62 0.383 0.617 1
## balita -0.74 0.543 0.457 1
## positif_cov 0.98 0.957 0.043 1
## rawat_cov 0.86 0.743 0.257 1
## isoman_cov 0.74 0.542 0.458 1
##
## MR1
## SS loadings 3.80
## Proportion Var 0.42
##
## Mean item complexity = 1
## Test of the hypothesis that 1 factor is sufficient.
##
## The degrees of freedom for the null model are 36 and the objective function was 5.9
## The degrees of freedom for the model are 27 and the objective function was 1.98
##
## The root mean square of the residuals (RMSR) is 0.13
## The df corrected root mean square of the residuals is 0.15
##
## Fit based upon off diagonal values = 0.91
k <- fa.parallel(x = covid2[,c(2:10)],
fa = "fa")
## Parallel analysis suggests that the number of factors = 3 and the number of components = NA
k
## Call: fa.parallel(x = covid2[, c(2:10)], fa = "fa")
## Parallel analysis suggests that the number of factors = 3 and the number of components = NA
##
## Eigen Values of
##
## eigen values of factors
## [1] 3.80 0.67 0.48 0.20 -0.07 -0.13 -0.24 -0.33 -0.58
##
## eigen values of simulated factors
## [1] 1.05 0.54 0.33 0.18 0.05 -0.08 -0.20 -0.33 -0.49
##
## eigen values of components
## [1] 4.20 1.51 1.13 0.79 0.48 0.42 0.25 0.15 0.06
##
## eigen values of simulated components
## [1] NA
based on the graph above we can see that the k optimum is 1 since there is only 1 point that goes above the horizontal line 1. or we can also put it this way
k_nfact <- k$nfact
k_nfact
## [1] 3
now let’s make a factor analysis using type of varimax factor
optimum_covid <- fa(
r = covid_cor2,
nfactors = 1,
rotate = "varimax"
)
optimum_covid
## Factor Analysis using method = minres
## Call: fa(r = covid_cor2, nfactors = 1, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
## MR1 h2 u2 com
## RS_covid 0.24 0.059 0.941 1
## rasio_ketergantungan -0.35 0.121 0.879 1
## RS 0.36 0.127 0.873 1
## apotek 0.57 0.324 0.676 1
## puskesmas 0.62 0.383 0.617 1
## balita -0.74 0.543 0.457 1
## positif_cov 0.98 0.957 0.043 1
## rawat_cov 0.86 0.743 0.257 1
## isoman_cov 0.74 0.542 0.458 1
##
## MR1
## SS loadings 3.80
## Proportion Var 0.42
##
## Mean item complexity = 1
## Test of the hypothesis that 1 factor is sufficient.
##
## The degrees of freedom for the null model are 36 and the objective function was 5.9
## The degrees of freedom for the model are 27 and the objective function was 1.98
##
## The root mean square of the residuals (RMSR) is 0.13
## The df corrected root mean square of the residuals is 0.15
##
## Fit based upon off diagonal values = 0.91
as the factor only 1, there is no cumulative portion. the proportion of our only factor is 0.42
fa.diagram(optimum_covid)
We can see that variable balita and rasio_ketergantungan is correlated negatively with the factor, while other variables correlated positively with the social vulnerability. for the variables that correlated negatively, the higher the value of the variable then the stronger for individual from the social vulnerability, and as for the positively correlated variables work the other way around. As the aforementioned that the factor covered as much as 0.42
pca <- prcomp(covid2[,2:10], scale. = T)
as.data.frame(pca$x)
## PC1 PC2 PC3 PC4 PC5 PC6
## 1 2.00264158 1.18915932 1.903292895 -1.267537012 -0.41391759 0.63090316
## 2 -1.19634196 -2.09237792 0.975824503 0.885907383 0.33015165 -0.71525005
## 3 3.44841171 2.12929900 -0.007497212 0.706690296 1.17203223 0.41829452
## 4 0.54547278 -0.60533372 0.503744382 -1.487081606 0.47408983 0.19715187
## 5 0.31553984 0.36182377 -1.193193945 1.353675712 -0.03649391 -1.11840659
## 6 1.09540845 1.92377390 -0.209204064 -0.686572052 -0.39516799 -0.77226911
## 7 0.85049823 0.01092865 0.373552600 -0.297437915 0.95409266 -0.87512416
## 8 3.36779508 1.03466003 -2.133980548 -0.493375484 0.24539934 -0.47929655
## 9 -2.21276086 -0.37228714 1.368271977 -0.494806164 0.18330415 0.03058264
## 10 1.17872428 0.28224808 0.145162396 2.075194395 -0.08980157 1.17995922
## 11 1.71625073 -0.76383506 -0.813593633 -2.199124231 1.16823268 -0.97977306
## 12 1.19277478 0.22810809 -0.319247924 0.626458512 -1.02438682 -0.49765995
## 13 -2.01978203 0.91436467 0.839618264 0.686082844 -0.18249114 -0.32983429
## 14 1.29106700 0.10839622 0.319612811 1.406914405 -1.64753131 -0.75134836
## 15 0.50082354 -0.63696408 0.126831361 -0.808933922 -1.56607302 0.35432216
## 16 0.91318213 -0.35501840 0.003039550 -0.461506549 -0.42748985 -0.52261981
## 17 2.14331887 -1.24195659 -0.525061306 1.330452994 0.65714050 0.50312816
## 18 -0.87848109 -0.46758218 -0.021842942 -0.170750033 0.81279642 -0.21331329
## 19 0.23736263 0.42191572 -0.610601225 -0.196760904 0.12363070 -0.54397563
## 20 0.80921556 1.40141316 0.083897777 0.903695030 0.40255010 0.18286300
## 21 -7.07327111 0.78899643 -3.866147978 -0.008137968 0.19965953 0.02477375
## 22 -5.57487024 0.30139810 -1.514506720 -0.755438912 -0.61176114 0.73172468
## 23 0.47579879 -1.16059444 -0.713117410 1.335017887 0.18427763 -0.44261659
## 24 1.15825325 0.24208341 -0.740244695 -0.339698033 0.07906331 -0.12437228
## 25 0.83272068 -1.30876411 0.111521235 -0.467365950 0.19450553 -0.57921955
## 26 -1.26073213 -0.03502628 1.581196415 -0.107288521 -0.68792775 -0.96870567
## 27 -1.02816630 1.48646864 1.442654087 -0.133235618 -0.11351522 0.47936589
## 28 -2.26773278 -1.83766673 0.801933609 0.046960190 0.41604746 0.41860704
## 29 -1.06159195 0.51559917 0.875852058 0.338423476 0.90001640 0.18550236
## 30 0.15068688 -1.35356154 0.047691536 0.579572332 -1.33266387 -1.15418022
## 31 -0.41799458 0.73610840 0.142868335 -0.637983805 -0.63647572 0.09491356
## 32 1.62145459 1.37284235 -0.723237621 -1.675049685 0.01834498 0.28262712
## 33 -0.20037763 0.74906319 0.756218932 -0.527848968 0.64912006 -0.04792745
## 34 1.74121219 -1.17473615 -0.801239797 0.737193850 1.00861873 0.04325412
## 35 -1.15299811 0.46335290 0.528471602 -0.299941971 0.26256660 -0.25302356
## 36 2.20199461 -2.84308042 -1.066003354 -0.615694703 -0.41528803 1.24524910
## 37 -1.41989202 -2.60926781 0.581259659 0.282166621 0.62693188 0.37443493
## 38 -1.61135601 0.01254958 0.577702512 0.121648576 -0.38721807 -0.21206233
## 39 -0.50777955 -2.36131949 0.813948927 -0.829726108 -0.24676311 0.80192295
## 40 -1.61178637 1.47050206 0.809544770 0.751449132 0.47991154 0.95219911
## 41 -0.70868731 1.69164753 0.648089490 0.022643794 -0.52653491 0.54544146
## 42 -1.07490809 1.09908820 0.546434895 1.045038658 0.69048226 0.17553946
## 43 3.55215988 -0.19793533 -1.853144964 0.268511956 -0.93963847 1.41658118
## 44 -0.06325793 0.48151679 0.203628762 -0.542401928 -0.55182673 0.31163704
## PC7 PC8 PC9
## 1 -0.30250152 0.63543041 0.623751859
## 2 0.15798608 0.47675313 0.195228325
## 3 -1.22402824 0.22733329 -0.009303394
## 4 -0.24132740 -0.36359789 -0.217552433
## 5 0.29644871 -0.25417842 -0.282334882
## 6 -0.50103951 -0.16010844 -0.085405163
## 7 -0.39198677 0.32808830 0.051355423
## 8 0.40543104 0.45386422 0.050878850
## 9 -0.29087313 0.13716102 -0.049071327
## 10 -0.74541637 -0.60819781 0.185840559
## 11 -0.49923124 -0.28011407 -0.108553963
## 12 -0.69502650 -0.55230932 -0.135047728
## 13 0.42875649 -0.55933612 -0.159912570
## 14 -0.10734915 0.37106158 -0.155076705
## 15 -0.99781009 0.08787311 -0.542872697
## 16 0.26868043 0.11069910 0.110760733
## 17 -0.39150180 0.10626079 0.333204912
## 18 0.63661244 -0.33556931 -0.282460351
## 19 0.82028989 0.36397769 0.477940527
## 20 -0.34462706 -0.39945726 0.061085274
## 21 -0.74482903 0.30843403 0.269385960
## 22 -0.34329999 0.09125564 0.013181310
## 23 0.06615720 -0.42145108 0.264026104
## 24 0.59431990 0.21159131 0.095771795
## 25 -0.64174346 -0.21154710 -0.027931842
## 26 -0.23912033 0.18562651 0.158995352
## 27 0.36275124 0.01203263 0.207522148
## 28 0.12281615 -0.18154346 0.018106933
## 29 0.21200370 -0.37004423 -0.356992667
## 30 0.04216447 0.16395309 0.232029835
## 31 0.71796973 0.19428925 -0.327875019
## 32 0.33658908 -0.35802112 -0.034352359
## 33 -0.09792052 -0.31638826 0.143900360
## 34 0.41084167 0.98743465 -0.607051254
## 35 0.75713219 -0.58382170 0.392912689
## 36 0.38923199 -0.40996720 0.055088250
## 37 0.17741265 -0.19289717 -0.033436913
## 38 0.11775524 -0.13930164 -0.203556916
## 39 -0.51836885 0.66602870 0.046055266
## 40 0.07209403 0.49573936 -0.299167437
## 41 0.59749577 0.37301591 -0.231436622
## 42 0.32445248 0.31923354 0.028263647
## 43 0.71901278 -0.04532086 0.063243636
## 44 0.28359560 -0.56396479 0.070862495
Now let’s take the PC1 only as we have k = 1
pc_keep <- as.data.frame(pca$x[,1])
pc_keep <-
pc_keep |>
rename(
PC1 = `pca$x[, 1]`
)
SoVI <- pc_keep |>
mutate(SoVI = 0.42*abs(PC1))
SoVI
## PC1 SoVI
## 1 2.00264158 0.84110946
## 2 -1.19634196 0.50246362
## 3 3.44841171 1.44833292
## 4 0.54547278 0.22909857
## 5 0.31553984 0.13252673
## 6 1.09540845 0.46007155
## 7 0.85049823 0.35720926
## 8 3.36779508 1.41447393
## 9 -2.21276086 0.92935956
## 10 1.17872428 0.49506420
## 11 1.71625073 0.72082531
## 12 1.19277478 0.50096541
## 13 -2.01978203 0.84830845
## 14 1.29106700 0.54224814
## 15 0.50082354 0.21034589
## 16 0.91318213 0.38353650
## 17 2.14331887 0.90019393
## 18 -0.87848109 0.36896206
## 19 0.23736263 0.09969230
## 20 0.80921556 0.33987054
## 21 -7.07327111 2.97077387
## 22 -5.57487024 2.34144550
## 23 0.47579879 0.19983549
## 24 1.15825325 0.48646636
## 25 0.83272068 0.34974269
## 26 -1.26073213 0.52950749
## 27 -1.02816630 0.43182985
## 28 -2.26773278 0.95244777
## 29 -1.06159195 0.44586862
## 30 0.15068688 0.06328849
## 31 -0.41799458 0.17555772
## 32 1.62145459 0.68101093
## 33 -0.20037763 0.08415860
## 34 1.74121219 0.73130912
## 35 -1.15299811 0.48425921
## 36 2.20199461 0.92483773
## 37 -1.41989202 0.59635465
## 38 -1.61135601 0.67676952
## 39 -0.50777955 0.21326741
## 40 -1.61178637 0.67695027
## 41 -0.70868731 0.29764867
## 42 -1.07490809 0.45146140
## 43 3.55215988 1.49190715
## 44 -0.06325793 0.02656833
As we’ve found our Social Vurnerability Index (SoVI), let’s combine them into our data frame
covid_new <- covid2 %>%
select_if(~!is.numeric(.)) |>
cbind(SoVI = SoVI[,2])
covid_new
## Kecamatan SoVI
## 1 CAKUNG 0.84110946
## 2 CEMPAKA PUTIH 0.50246362
## 3 CENGKARENG 1.44833292
## 4 CILANDAK 0.22909857
## 5 CILINCING 0.13252673
## 6 CIPAYUNG 0.46007155
## 7 CIRACAS 0.35720926
## 8 DUREN SAWIT 1.41447393
## 9 GAMBIR 0.92935956
## 10 GROGOL PETAMBURAN 0.49506420
## 11 JAGAKARSA 0.72082531
## 12 JATINEGARA 0.50096541
## 13 JOHAR BARU 0.84830845
## 14 KALI DERES 0.54224814
## 15 KEBAYORAN BARU 0.21034589
## 16 KEBAYORAN LAMA 0.38353650
## 17 KEBON JERUK 0.90019393
## 18 KELAPA GADING 0.36896206
## 19 KEMAYORAN 0.09969230
## 20 KEMBANGAN 0.33987054
## 21 KEP. SERIBU SLT 2.97077387
## 22 KEP. SERIBU UTR 2.34144550
## 23 KOJA 0.19983549
## 24 KRAMAT JATI 0.48646636
## 25 MAKASAR 0.34974269
## 26 MAMPANG PRAPATAN 0.52950749
## 27 MATRAMAN 0.43182985
## 28 MENTENG 0.95244777
## 29 PADEMANGAN 0.44586862
## 30 PALMERAH 0.06328849
## 31 PANCORAN 0.17555772
## 32 PASAR MINGGU 0.68101093
## 33 PASAR REBO 0.08415860
## 34 PENJARINGAN 0.73130912
## 35 PESANGGRAHAN 0.48425921
## 36 PULO GADUNG 0.92483773
## 37 SAWAH BESAR 0.59635465
## 38 SENEN 0.67676952
## 39 SETIA BUDI 0.21326741
## 40 TAMAN SARI 0.67695027
## 41 TAMBORA 0.29764867
## 42 TANAH ABANG 0.45146140
## 43 TANJUNG PRIOK 1.49190715
## 44 TEBET 0.02656833
We will now be classifying each sub-districts based on each SoVI value
myfunction <- function(df, var) {
breaks <- BAMMtools::getJenksBreaks(df[[var]], k = 4)
df %>%
mutate("Class" :=
case_when(df[[var]] >= breaks[[1]] & df[[var]] < breaks[[2]] ~ 1,
df[[var]] >= breaks[[2]] & df[[var]] < breaks[[3]] ~ 2,
df[[var]] >= breaks[[3]] & df[[var]] <= breaks[[4]] ~ 3))
}
covid_new <- myfunction(covid_new, "SoVI")
covid_new |>
group_by(Class) |>
summarise(Total_SubDistricts = n())
## # A tibble: 3 × 2
## Class Total_SubDistricts
## <dbl> <int>
## 1 1 27
## 2 2 14
## 3 3 3
The next step for this case usually will be followed with creating a
geospatial visualization, but due to error in gdal and
sf configuration on my device (gdal hasn’t support for
MacOS Ventura, hence we cannot also conduct configuration for package
sf) we will leave it be and get on with our project to the Fuzzy
C-Means Clustering Methodolgy.
as our covid data is already all numerical except for subdistrict, let’s change subdistrict as row names
library(tibble)
covid_FCM <-
covid %>%
remove_rownames %>%
column_to_rownames(var="Kecamatan")
covid_FCM
## lansia disabilitas kepadatan_penduduk penduduk_nonmuslim
## CAKUNG 6.217495 0.03013983 96231 8.75538398
## CEMPAKA PUTIH 10.852327 0.01034276 71886 13.63898585
## CENGKARENG 6.585898 0.14911626 124663 19.55638163
## CILANDAK 9.310706 0.02100348 64898 9.77313475
## CILINCING 5.975218 0.01451552 134303 8.34963145
## CIPAYUNG 7.000645 0.38417211 84663 10.50079611
## CIRACAS 7.754256 0.04016695 98094 10.99675024
## DUREN SAWIT 9.273389 0.03645871 159733 12.67802665
## GAMBIR 13.219493 0.02774585 104599 28.28163225
## GROGOL PETAMBURAN 11.359290 0.28877102 149617 42.51067642
## JAGAKARSA 7.278065 0.04142144 93985 5.55755995
## JATINEGARA 9.316097 0.02359329 282743 13.39173662
## JOHAR BARU 9.425287 0.02726502 297195 13.13970991
## KALI DERES 5.872705 0.03099408 75338 19.61835420
## KEBAYORAN BARU 10.444885 0.02096464 116274 10.66691336
## KEBAYORAN LAMA 8.820369 0.02705556 119480 11.03836184
## KEBON JERUK 8.869410 0.03217434 151196 20.40154423
## KELAPA GADING 13.009807 0.01224524 26578 50.68830916
## KEMAYORAN 9.508128 0.03957262 336676 14.55452125
## KEMBANGAN 8.304381 0.04385549 75424 20.46552827
## KEP. SERIBU SLT 6.428281 0.25665155 11877 0.04063389
## KEP. SERIBU UTR 6.357459 0.04819277 15231 0.08271787
## KOJA 6.722973 0.06687264 188684 9.02111214
## KRAMAT JATI 7.873820 0.03196308 166030 9.52583317
## MAKASAR 7.907364 0.02397530 89639 11.55006260
## MAMPANG PRAPATAN 7.941966 0.05037039 124675 5.77386079
## MATRAMAN 9.763831 0.06179128 244259 9.06275179
## MENTENG 12.001173 0.03087267 77583 13.16012426
## PADEMANGAN 8.629675 0.02876190 51871 30.47330119
## PALMERAH 8.581465 0.03357468 210225 10.96043354
## PANCORAN 8.353375 0.03729480 123449 7.45250935
## PASAR MINGGU 8.068711 0.04029408 114641 6.33586981
## PASAR REBO 7.434712 0.04139644 88888 10.26829963
## PENJARINGAN 9.688375 0.03512149 68821 42.97008148
## PESANGGRAHAN 8.124171 0.02155219 103294 7.75427235
## PULO GADUNG 9.421175 0.01707613 154593 16.72384497
## SAWAH BESAR 10.985273 0.03067078 161536 39.75889180
## SENEN 13.159865 0.01019376 196774 18.94399134
## SETIA BUDI 9.434795 0.03362658 123086 14.64476330
## TAMAN SARI 13.021969 0.03642423 230712 41.47921401
## TAMBORA 9.698863 0.07796560 596126 39.11887053
## TANAH ABANG 9.813990 0.02350881 173891 10.40904483
## TANJUNG PRIOK 8.191536 0.01822963 160576 21.78284134
## TEBET 9.886114 0.03708176 218376 8.26883625
## pendidikan_rendah RS_covid rasio_ketergantungan WNA
## CAKUNG 0.3984311 1 35.00000 0.005758871
## CEMPAKA PUTIH 0.2939110 5 39.66667 0.053748730
## CENGKARENG 0.4557412 1 39.16667 0.018045530
## CILANDAK 0.3270238 2 38.40000 0.129418856
## CILINCING 0.4765231 3 43.00000 0.002725743
## CIPAYUNG 0.3480075 1 39.75000 0.004460778
## CIRACAS 0.3389411 3 39.60000 0.003158071
## DUREN SAWIT 0.3358792 2 41.57143 0.010518777
## GAMBIR 0.3318871 2 38.50000 0.054769869
## GROGOL PETAMBURAN 0.3503879 2 39.85714 0.072026912
## JAGAKARSA 0.3456044 3 40.16667 0.023404630
## JATINEGARA 0.3714188 3 40.12500 0.016141558
## JOHAR BARU 0.4255975 1 40.50000 0.007525433
## KALI DERES 0.4814726 4 39.20000 0.011555607
## KEBAYORAN BARU 0.3134974 3 37.80000 0.206289276
## KEBAYORAN LAMA 0.3478937 3 39.33333 0.089768240
## KEBON JERUK 0.3627009 4 40.28571 0.035534449
## KELAPA GADING 0.2687032 2 41.00000 0.168493749
## KEMAYORAN 0.3499071 2 40.87500 0.067545002
## KEMBANGAN 0.3728452 1 40.33333 0.035090941
## KEP. SERIBU SLT 0.5981627 0 47.33333 0.000000000
## KEP. SERIBU UTR 0.5747165 0 42.66667 0.000000000
## KOJA 0.4324709 4 41.83333 0.003726883
## KRAMAT JATI 0.3493858 2 40.42857 0.006610134
## MAKASAR 0.3107599 4 39.40000 0.002227628
## MAMPANG PRAPATAN 0.3560600 3 38.20000 0.146880669
## MATRAMAN 0.3120595 0 38.16667 0.006277924
## MENTENG 0.3348908 3 39.60000 0.065128194
## PADEMANGAN 0.4314941 1 40.00000 0.091401210
## PALMERAH 0.3812620 5 39.83333 0.036916209
## PANCORAN 0.3281217 1 39.33333 0.047510506
## PASAR MINGGU 0.3338986 0 39.57143 0.046388476
## PASAR REBO 0.3223881 1 39.20000 0.006805933
## PENJARINGAN 0.4376093 4 40.80000 0.081416523
## PESANGGRAHAN 0.3340688 1 40.20000 0.021531860
## PULO GADUNG 0.3299724 4 39.28571 0.020347457
## SAWAH BESAR 0.3648798 4 39.80000 0.136839823
## SENEN 0.4003476 2 39.83333 0.027822646
## SETIA BUDI 0.3375409 4 37.25000 0.150810394
## TAMAN SARI 0.4047287 0 39.50000 0.048675336
## TAMBORA 0.4758446 0 38.90909 0.020483783
## TANAH ABANG 0.3711396 1 40.42857 0.081478056
## TANJUNG PRIOK 0.3689941 2 40.14286 0.057170762
## TEBET 0.3187007 1 39.28571 0.035899086
## RS tenaga_kesehatan apotek puskesmas balita positif_cov
## CAKUNG 1 1503 62 9 4.285196 11740
## CEMPAKA PUTIH 2 2027 47 4 7.437936 4998
## CENGKARENG 1 2038 121 10 3.815583 13036
## CILANDAK 3 1414 39 6 5.903733 8201
## CILINCING 1 1396 64 10 5.542494 7899
## CIPAYUNG 0 1399 56 11 7.355121 10437
## CIRACAS 1 1399 60 6 4.932431 9529
## DUREN SAWIT 2 1545 60 12 4.900923 14329
## GAMBIR 1 1568 36 4 13.433800 3796
## GROGOL PETAMBURAN 3 1899 110 10 7.591609 8298
## JAGAKARSA 3 1178 31 6 5.171431 11785
## JATINEGARA 2 1733 69 12 6.613320 8948
## JOHAR BARU 0 2142 49 7 7.324849 4179
## KALI DERES 1 1313 71 13 4.185169 8039
## KEBAYORAN BARU 3 1679 43 11 14.279972 6364
## KEBAYORAN LAMA 2 1532 41 9 5.012718 9375
## KEBON JERUK 4 1606 92 8 5.832477 10489
## KELAPA GADING 2 856 39 5 5.843335 5919
## KEMAYORAN 1 1836 39 8 7.852908 9919
## KEMBANGAN 1 1498 87 9 5.865853 9081
## KEP. SERIBU SLT 0 100 0 4 51.531898 242
## KEP. SERIBU UTR 1 113 0 5 38.327917 317
## KOJA 3 1452 67 8 5.876079 8505
## KRAMAT JATI 2 1211 47 9 6.229676 10117
## MAKASAR 3 1252 50 7 6.378732 8752
## MAMPANG PRAPATAN 0 1355 39 7 8.079633 5771
## MATRAMAN 0 1252 53 7 7.995961 6402
## MENTENG 3 1568 35 3 12.559468 3242
## PADEMANGAN 1 1247 61 5 5.595920 5034
## PALMERAH 2 803 40 10 7.115865 7709
## PANCORAN 1 1237 32 9 8.621031 6421
## PASAR MINGGU 2 1532 40 10 5.994425 11474
## PASAR REBO 1 1273 54 6 6.309955 8176
## PENJARINGAN 3 1489 70 7 4.959259 8034
## PESANGGRAHAN 1 1267 36 6 5.491051 7396
## PULO GADUNG 7 1211 42 9 6.100957 9901
## SAWAH BESAR 4 1836 41 3 9.392756 4072
## SENEN 1 1836 40 7 10.705354 4477
## SETIA BUDI 4 1296 35 5 15.419470 5478
## TAMAN SARI 0 1174 70 6 14.123495 3907
## TAMBORA 0 927 51 9 9.875938 5846
## TANAH ABANG 0 2906 70 6 9.464120 5823
## TANJUNG PRIOK 5 1638 69 14 5.396194 12492
## TEBET 2 1561 42 9 7.391676 7884
## rawat_cov isoman_cov
## CAKUNG 82 102
## CEMPAKA PUTIH 50 17
## CENGKARENG 109 146
## CILANDAK 62 114
## CILINCING 73 63
## CIPAYUNG 63 124
## CIRACAS 73 108
## DUREN SAWIT 139 145
## GAMBIR 25 42
## GROGOL PETAMBURAN 67 43
## JAGAKARSA 80 175
## JATINEGARA 55 87
## JOHAR BARU 25 19
## KALI DERES 73 50
## KEBAYORAN BARU 55 98
## KEBAYORAN LAMA 76 83
## KEBON JERUK 102 73
## KELAPA GADING 61 60
## KEMAYORAN 86 63
## KEMBANGAN 67 76
## KEP. SERIBU SLT 0 0
## KEP. SERIBU UTR 3 4
## KOJA 68 47
## KRAMAT JATI 98 87
## MAKASAR 59 104
## MAMPANG PRAPATAN 24 44
## MATRAMAN 47 37
## MENTENG 33 17
## PADEMANGAN 49 52
## PALMERAH 54 43
## PANCORAN 71 62
## PASAR MINGGU 91 132
## PASAR REBO 51 82
## PENJARINGAN 131 88
## PESANGGRAHAN 42 41
## PULO GADUNG 107 85
## SAWAH BESAR 48 25
## SENEN 36 37
## SETIA BUDI 62 59
## TAMAN SARI 61 28
## TAMBORA 69 42
## TANAH ABANG 64 29
## TANJUNG PRIOK 142 90
## TEBET 54 66
now we will compute the MinMax for our data
minMax <- function(x) {
(x - min(x)) / (max(x) - min(x))
}
scale <- as.data.frame(lapply(covid_FCM, minMax))
covid_FCM <- as.data.frame(scale, covid$Kecamatan)
covid_FCM
## lansia disabilitas kepadatan_penduduk penduduk_nonmuslim
## CAKUNG 0.04693080 0.0533348338 0.144380221 0.1720661421
## CEMPAKA PUTIH 0.67779574 0.0003984166 0.102711344 0.2684891634
## CENGKARENG 0.09707556 0.3714720340 0.193044404 0.3853236627
## CILANDAK 0.46795975 0.0289046624 0.090750690 0.1921608605
## CILINCING 0.01395345 0.0115561738 0.209544218 0.1640548656
## CIPAYUNG 0.15352836 1.0000000000 0.124580444 0.2065279831
## CIRACAS 0.25610534 0.0801468722 0.147568930 0.2163202219
## DUREN SAWIT 0.46288044 0.0702312065 0.253070181 0.2495157515
## GAMBIR 1.00000000 0.0469334340 0.158702882 0.5575971298
## GROGOL PETAMBURAN 0.74680051 0.7449021150 0.235755645 0.8385388332
## JAGAKARSA 0.19128910 0.0835012922 0.140535970 0.1089275279
## JATINEGARA 0.46869349 0.0358296990 0.463613973 0.2636074146
## JOHAR BARU 0.48355587 0.0456477322 0.488350001 0.2586313379
## KALI DERES 0.00000000 0.0556190447 0.108619784 0.3865472642
## KEBAYORAN BARU 0.62233733 0.0288007994 0.178685800 0.2098078425
## KEBAYORAN LAMA 0.40121807 0.0450876450 0.184173186 0.2171418113
## KEBON JERUK 0.40789323 0.0587750126 0.238458260 0.4020107583
## KELAPA GADING 0.97145883 0.0054855628 0.025162217 1.0000000000
## KEMAYORAN 0.49483160 0.0785576383 0.555925641 0.2865657167
## KEMBANGAN 0.33098498 0.0900098373 0.108766981 0.4032740747
## KEP. SERIBU SLT 0.07562168 0.6590162061 0.000000000 0.0000000000
## KEP. SERIBU UTR 0.06598185 0.1016075163 0.005740703 0.0008309164
## KOJA 0.11573338 0.1515565894 0.302622683 0.1773127435
## KRAMAT JATI 0.27237959 0.0582101201 0.263848120 0.1872780780
## MAKASAR 0.27694544 0.0368511726 0.133097361 0.2272449554
## MAMPANG PRAPATAN 0.28165521 0.1074303646 0.193064943 0.1131982241
## MATRAMAN 0.52963631 0.1379692684 0.397744797 0.1781348867
## MENTENG 0.83416971 0.0552943976 0.112462323 0.2590344038
## PADEMANGAN 0.37526201 0.0496502977 0.068453690 0.6008699734
## PALMERAH 0.36869987 0.0625194532 0.339492237 0.2156031761
## PANCORAN 0.33765364 0.0724668682 0.190966523 0.1463418690
## PASAR MINGGU 0.29890696 0.0804867947 0.175890759 0.1242946668
## PASAR REBO 0.21261087 0.0834344558 0.131811950 0.2019375162
## PENJARINGAN 0.51936571 0.0666555308 0.097465293 0.8476094384
## PESANGGRAHAN 0.30645587 0.0303718886 0.156469245 0.1522999510
## PULO GADUNG 0.48299608 0.0184031258 0.244272562 0.3293973709
## SAWAH BESAR 0.69589161 0.0547545557 0.256156194 0.7842069295
## SENEN 0.99188382 0.0000000000 0.316469519 0.3732324801
## SETIA BUDI 0.48484996 0.0626582302 0.190345212 0.2883474777
## TAMAN SARI 0.97311418 0.0701389965 0.374557766 0.8181733890
## TAMBORA 0.52079335 0.1812186249 1.000000000 0.7715701940
## TANAH ABANG 0.53646375 0.0356037914 0.277302999 0.2047164235
## TANJUNG PRIOK 0.31562520 0.0214875395 0.254513059 0.4292834239
## TEBET 0.54628073 0.0718972005 0.353443480 0.1624596255
## pendidikan_rendah RS_covid rasio_ketergantungan WNA
## CAKUNG 0.39375972 0.2 0.0000000 0.02791648
## CEMPAKA PUTIH 0.07651272 1.0 0.3783785 0.26055028
## CENGKARENG 0.56771177 0.2 0.3378379 0.08747682
## CILANDAK 0.17701898 0.4 0.2756758 0.62736589
## CILINCING 0.63079053 0.6 0.6486488 0.01321321
## CIPAYUNG 0.24071021 0.2 0.3851352 0.02162390
## CIRACAS 0.21319123 0.6 0.3729731 0.01530894
## DUREN SAWIT 0.20389751 0.4 0.5328187 0.05099042
## GAMBIR 0.19178045 0.4 0.2837839 0.26550032
## GROGOL PETAMBURAN 0.24793560 0.4 0.3938225 0.34915490
## JAGAKARSA 0.23341617 0.6 0.4189190 0.11345539
## JATINEGARA 0.31177014 0.6 0.4155407 0.07824720
## JOHAR BARU 0.47621723 0.2 0.4459461 0.03648000
## KALI DERES 0.64581338 0.8 0.3405406 0.05601652
## KEBAYORAN BARU 0.13596285 0.6 0.2270271 1.00000000
## KEBAYORAN LAMA 0.24036486 0.6 0.3513512 0.43515709
## KEBON JERUK 0.28530877 0.8 0.4285712 0.17225544
## KELAPA GADING 0.00000000 0.4 0.4864866 0.81678385
## KEMAYORAN 0.24647624 0.4 0.4763515 0.32742857
## KEMBANGAN 0.31609960 0.2 0.4324323 0.17010550
## KEP. SERIBU SLT 1.00000000 0.0 1.0000000 0.00000000
## KEP. SERIBU UTR 0.92883448 0.0 0.6216221 0.00000000
## KOJA 0.49707979 0.8 0.5540539 0.01806629
## KRAMAT JATI 0.24489384 0.4 0.4401544 0.03204303
## MAKASAR 0.12765378 0.8 0.3567569 0.01079856
## MAMPANG PRAPATAN 0.26515178 0.6 0.2594595 0.71201311
## MATRAMAN 0.13159830 0.0 0.2567571 0.03043262
## MENTENG 0.20089743 0.6 0.3729731 0.31571294
## PADEMANGAN 0.49411514 0.2 0.4054055 0.44307301
## PALMERAH 0.34164700 1.0 0.3918917 0.17895360
## PANCORAN 0.18035158 0.2 0.3513512 0.23031011
## PASAR MINGGU 0.19788584 0.0 0.3706566 0.22487100
## PASAR REBO 0.16294857 0.2 0.3405406 0.03299218
## PENJARINGAN 0.51267632 0.8 0.4702704 0.39467162
## PESANGGRAHAN 0.19840256 0.2 0.4216217 0.10437702
## PULO GADUNG 0.18596875 0.8 0.3474901 0.09863555
## SAWAH BESAR 0.29192252 0.8 0.3891893 0.66333949
## SENEN 0.39957690 0.4 0.3918917 0.13487199
## SETIA BUDI 0.20894129 0.8 0.1824325 0.73106269
## TAMAN SARI 0.41287483 0.0 0.3648650 0.23595669
## TAMBORA 0.62873093 0.0 0.3169533 0.09929640
## TANAH ABANG 0.31092262 0.2 0.4401544 0.39496991
## TANJUNG PRIOK 0.30441051 0.4 0.4169888 0.27713880
## TEBET 0.15175607 0.2 0.3474901 0.17402304
## RS tenaga_kesehatan apotek puskesmas balita
## CAKUNG 0.1428571 0.500000000 0.5123967 0.54545455 0.009841763
## CEMPAKA PUTIH 0.2857143 0.686742694 0.3884298 0.09090909 0.075914343
## CENGKARENG 0.1428571 0.690662865 1.0000000 0.63636364 0.000000000
## CILANDAK 0.4285714 0.468282252 0.3223140 0.27272727 0.043761764
## CILINCING 0.1428571 0.461867427 0.5289256 0.63636364 0.036191213
## CIPAYUNG 0.0000000 0.462936565 0.4628099 0.72727273 0.074178783
## CIRACAS 0.1428571 0.462936565 0.4958678 0.27272727 0.023405997
## DUREN SAWIT 0.2857143 0.514967926 0.4958678 0.81818182 0.022745675
## GAMBIR 0.1428571 0.523164647 0.2975207 0.09090909 0.201570822
## GROGOL PETAMBURAN 0.4285714 0.641126158 0.9090909 0.63636364 0.079134901
## JAGAKARSA 0.4285714 0.384176764 0.2561983 0.27272727 0.028414764
## JATINEGARA 0.2857143 0.581967213 0.5702479 0.81818182 0.058632709
## JOHAR BARU 0.0000000 0.727726301 0.4049587 0.36363636 0.073544373
## KALI DERES 0.1428571 0.432287954 0.5867769 0.90909091 0.007745482
## KEBAYORAN BARU 0.4285714 0.562722737 0.3553719 0.72727273 0.219304220
## KEBAYORAN LAMA 0.2857143 0.510334996 0.3388430 0.54545455 0.025088598
## KEBON JERUK 0.5714286 0.536707056 0.7603306 0.45454545 0.042268431
## KELAPA GADING 0.2857143 0.269422666 0.3223140 0.18181818 0.042495989
## KEMAYORAN 0.1428571 0.618674269 0.3223140 0.45454545 0.084610991
## KEMBANGAN 0.1428571 0.498218104 0.7190083 0.54545455 0.042967904
## KEP. SERIBU SLT 0.0000000 0.000000000 0.0000000 0.09090909 1.000000000
## KEP. SERIBU UTR 0.1428571 0.004632929 0.0000000 0.18181818 0.723281640
## KOJA 0.4285714 0.481824661 0.5537190 0.45454545 0.043182219
## KRAMAT JATI 0.2857143 0.395937277 0.3884298 0.54545455 0.050592620
## MAKASAR 0.4285714 0.410548824 0.4132231 0.36363636 0.053716405
## MAMPANG PRAPATAN 0.0000000 0.447255880 0.3223140 0.36363636 0.089362525
## MATRAMAN 0.0000000 0.410548824 0.4380165 0.36363636 0.087608985
## MENTENG 0.4285714 0.523164647 0.2892562 0.00000000 0.183247286
## PADEMANGAN 0.1428571 0.408766928 0.5041322 0.18181818 0.037310872
## PALMERAH 0.2857143 0.250534569 0.3305785 0.63636364 0.069164650
## PANCORAN 0.1428571 0.405203136 0.2644628 0.54545455 0.100708702
## PASAR MINGGU 0.2857143 0.510334996 0.3305785 0.63636364 0.045662406
## PASAR REBO 0.1428571 0.418032787 0.4462810 0.27272727 0.052275029
## PENJARINGAN 0.4285714 0.495010691 0.5785124 0.36363636 0.023968228
## PESANGGRAHAN 0.1428571 0.415894512 0.2975207 0.27272727 0.035113105
## PULO GADUNG 1.0000000 0.395937277 0.3471074 0.54545455 0.047895019
## SAWAH BESAR 0.5714286 0.618674269 0.3388430 0.00000000 0.116881896
## SENEN 0.1428571 0.618674269 0.3305785 0.36363636 0.144390253
## SETIA BUDI 0.5714286 0.426229508 0.2892562 0.18181818 0.243184902
## TAMAN SARI 0.0000000 0.382751247 0.5785124 0.27272727 0.216024889
## TAMBORA 0.0000000 0.294725588 0.4214876 0.54545455 0.127008026
## TANAH ABANG 0.0000000 1.000000000 0.5785124 0.27272727 0.118377486
## TANJUNG PRIOK 0.7142857 0.548111190 0.5702479 1.00000000 0.033125160
## TEBET 0.2857143 0.520669993 0.3471074 0.54545455 0.074944866
## positif_cov rawat_cov isoman_cov
## CAKUNG 0.816213530 0.57746479 0.58285714
## CEMPAKA PUTIH 0.337616242 0.35211268 0.09714286
## CENGKARENG 0.908213246 0.76760563 0.83428571
## CILANDAK 0.564988997 0.43661972 0.65142857
## CILINCING 0.543550792 0.51408451 0.36000000
## CIPAYUNG 0.723716902 0.44366197 0.70857143
## CIRACAS 0.659260311 0.51408451 0.61714286
## DUREN SAWIT 1.000000000 0.97887324 0.82857143
## GAMBIR 0.252289345 0.17605634 0.24000000
## GROGOL PETAMBURAN 0.571874778 0.47183099 0.24571429
## JAGAKARSA 0.819407965 0.56338028 1.00000000
## JATINEGARA 0.618016611 0.38732394 0.49714286
## JOHAR BARU 0.279477532 0.17605634 0.10857143
## KALI DERES 0.553489032 0.51408451 0.28571429
## KEBAYORAN BARU 0.434585078 0.38732394 0.56000000
## KEBAYORAN LAMA 0.648328246 0.53521127 0.47428571
## KEBON JERUK 0.727408249 0.71830986 0.41714286
## KELAPA GADING 0.402995670 0.42957746 0.34285714
## KEMAYORAN 0.686945411 0.60563380 0.36000000
## KEMBANGAN 0.627457940 0.47183099 0.43428571
## KEP. SERIBU SLT 0.000000000 0.00000000 0.00000000
## KEP. SERIBU UTR 0.005324058 0.02112676 0.02285714
## KOJA 0.586569177 0.47887324 0.26857143
## KRAMAT JATI 0.701000923 0.69014085 0.49714286
## MAKASAR 0.604103074 0.41549296 0.59428571
## MAMPANG PRAPATAN 0.392489529 0.16901408 0.25142857
## MATRAMAN 0.437282601 0.33098592 0.21142857
## MENTENG 0.212962306 0.23239437 0.09714286
## PADEMANGAN 0.340171790 0.34507042 0.29714286
## PALMERAH 0.530063179 0.38028169 0.24571429
## PANCORAN 0.438631362 0.50000000 0.35428571
## PASAR MINGGU 0.797330872 0.64084507 0.75428571
## PASAR REBO 0.563214311 0.35915493 0.46857143
## PENJARINGAN 0.553134095 0.92253521 0.50285714
## PESANGGRAHAN 0.507844112 0.29577465 0.23428571
## PULO GADUNG 0.685667637 0.75352113 0.48571429
## SAWAH BESAR 0.271881877 0.33802817 0.14285714
## SENEN 0.300631788 0.25352113 0.21142857
## SETIA BUDI 0.371690211 0.43661972 0.33714286
## TAMAN SARI 0.260168950 0.42957746 0.16000000
## TAMBORA 0.397813587 0.48591549 0.24000000
## TANAH ABANG 0.396180876 0.45070423 0.16571429
## TANJUNG PRIOK 0.869596081 1.00000000 0.51428571
## TEBET 0.542485980 0.38028169 0.37714286
library(cluster)
library(factoextra)
set.seed(422)
kfcm <-
fviz_nbclust(
x = scale,
FUNcluster = fanny,
method = "silhouette")
kfcm
we’ve found that the optimum k, let’s make a new object with the optimum k
library(ppclust)
set.seed(422)
covidfcm <- fcm(x = covid_FCM,
centers = 2)
summary(covidfcm)
## Summary for 'covidfcm'
##
## Number of data objects: 44
##
## Number of clusters: 2
##
## Crisp clustering vector:
## [1] 2 1 2 1 2 2 2 2 1 1 2 2 1 2 1 2 2 1 2 2 1 1 2 2 2 1 1 1 1 2 2 2 2 2 1 2 1 1
## [39] 1 1 1 1 2 1
##
## Initial cluster prototypes:
## lansia disabilitas kepadatan_penduduk penduduk_nonmuslim
## Cluster 1 0.330985 0.09000984 0.1087670 0.4032741
## Cluster 2 0.298907 0.08048679 0.1758908 0.1242947
## pendidikan_rendah RS_covid rasio_ketergantungan WNA RS
## Cluster 1 0.3160996 0.2 0.4324323 0.1701055 0.1428571
## Cluster 2 0.1978858 0.0 0.3706566 0.2248710 0.2857143
## tenaga_kesehatan apotek puskesmas balita positif_cov rawat_cov
## Cluster 1 0.4982181 0.7190083 0.5454545 0.04296790 0.6274579 0.4718310
## Cluster 2 0.5103350 0.3305785 0.6363636 0.04566241 0.7973309 0.6408451
## isoman_cov
## Cluster 1 0.4342857
## Cluster 2 0.7542857
##
## Final cluster prototypes:
## lansia disabilitas kepadatan_penduduk penduduk_nonmuslim
## Cluster 1 0.4591629 0.1166271 0.2285354 0.3414606
## Cluster 2 0.3936909 0.1188795 0.2254411 0.3127655
## pendidikan_rendah RS_covid rasio_ketergantungan WNA RS
## Cluster 1 0.3231679 0.4199911 0.3947412 0.2578983 0.2493198
## Cluster 2 0.3224934 0.4433548 0.3979552 0.2177715 0.2695025
## tenaga_kesehatan apotek puskesmas balita positif_cov rawat_cov
## Cluster 1 0.4781012 0.4209334 0.4023419 0.1220504 0.4878545 0.4355515
## Cluster 2 0.4732257 0.4426290 0.4594368 0.1009901 0.5536850 0.4875869
## isoman_cov
## Cluster 1 0.3583740
## Cluster 2 0.4168333
##
## Distance between the final cluster prototypes
## Cluster 1
## Cluster 2 0.02235545
##
## Difference between the initial and final cluster prototypes
## lansia disabilitas kepadatan_penduduk penduduk_nonmuslim
## Cluster 1 0.12817792 0.02661726 0.11976837 -0.06181345
## Cluster 2 0.09478391 0.03839274 0.04955039 0.18847088
## pendidikan_rendah RS_covid rasio_ketergantungan WNA
## Cluster 1 0.007068257 0.2199911 -0.03769107 0.087792792
## Cluster 2 0.124607568 0.4433548 0.02729858 -0.007099498
## RS tenaga_kesehatan apotek puskesmas balita
## Cluster 1 0.1064627 -0.02011692 -0.2980748 -0.1431127 0.07908249
## Cluster 2 -0.0162118 -0.03710932 0.1120505 -0.1769269 0.05532765
## positif_cov rawat_cov isoman_cov
## Cluster 1 -0.1396034 -0.0362795 -0.0759117
## Cluster 2 -0.2436458 -0.1532582 -0.3374524
##
## Root Mean Squared Deviations (RMSD): 0.6137484
## Mean Absolute Deviation (MAD): 29.54484
##
## Membership degrees matrix (top and bottom 5 rows):
## Cluster 1 Cluster 2
## CAKUNG 0.4394788 0.5605212
## CEMPAKA PUTIH 0.5365557 0.4634443
## CENGKARENG 0.4537151 0.5462849
## CILANDAK 0.5062377 0.4937623
## CILINCING 0.4422335 0.5577665
## ...
## Cluster 1 Cluster 2
## TAMAN SARI 0.5517926 0.4482074
## TAMBORA 0.5157426 0.4842574
## TANAH ABANG 0.5443728 0.4556272
## TANJUNG PRIOK 0.4485056 0.5514944
## TEBET 0.5111145 0.4888855
##
## Descriptive statistics for the membership degrees by clusters
## Size Min Q1 Mean Median Q3 Max
## Cluster 1 21 0.5062377 0.5157426 0.5370480 0.5368522 0.5508236 0.5750272
## Cluster 2 23 0.5041717 0.5314282 0.5503068 0.5563581 0.5613305 0.6307614
##
## Dunn's Fuzziness Coefficients:
## dunn_coeff normalized
## 0.50516573 0.01033147
##
## Within cluster sum of squares by cluster:
## 1 2
## 16.394065 9.986606
## (between_SS / total_SS = 0.92%)
##
## Available components:
## [1] "u" "v" "v0" "d" "x"
## [6] "cluster" "csize" "sumsqrs" "k" "m"
## [11] "iter" "best.start" "func.val" "comp.time" "inpargs"
## [16] "algorithm" "call"
let’s see how much data in each center
covidfcm$csize
## 1 2
## 21 23
next, lets binding the result to our dataframe
datacovidfcm <- data.frame(covid_FCM, covidfcm$cluster)
datacovidfcm
## lansia disabilitas kepadatan_penduduk penduduk_nonmuslim
## CAKUNG 0.04693080 0.0533348338 0.144380221 0.1720661421
## CEMPAKA PUTIH 0.67779574 0.0003984166 0.102711344 0.2684891634
## CENGKARENG 0.09707556 0.3714720340 0.193044404 0.3853236627
## CILANDAK 0.46795975 0.0289046624 0.090750690 0.1921608605
## CILINCING 0.01395345 0.0115561738 0.209544218 0.1640548656
## CIPAYUNG 0.15352836 1.0000000000 0.124580444 0.2065279831
## CIRACAS 0.25610534 0.0801468722 0.147568930 0.2163202219
## DUREN SAWIT 0.46288044 0.0702312065 0.253070181 0.2495157515
## GAMBIR 1.00000000 0.0469334340 0.158702882 0.5575971298
## GROGOL PETAMBURAN 0.74680051 0.7449021150 0.235755645 0.8385388332
## JAGAKARSA 0.19128910 0.0835012922 0.140535970 0.1089275279
## JATINEGARA 0.46869349 0.0358296990 0.463613973 0.2636074146
## JOHAR BARU 0.48355587 0.0456477322 0.488350001 0.2586313379
## KALI DERES 0.00000000 0.0556190447 0.108619784 0.3865472642
## KEBAYORAN BARU 0.62233733 0.0288007994 0.178685800 0.2098078425
## KEBAYORAN LAMA 0.40121807 0.0450876450 0.184173186 0.2171418113
## KEBON JERUK 0.40789323 0.0587750126 0.238458260 0.4020107583
## KELAPA GADING 0.97145883 0.0054855628 0.025162217 1.0000000000
## KEMAYORAN 0.49483160 0.0785576383 0.555925641 0.2865657167
## KEMBANGAN 0.33098498 0.0900098373 0.108766981 0.4032740747
## KEP. SERIBU SLT 0.07562168 0.6590162061 0.000000000 0.0000000000
## KEP. SERIBU UTR 0.06598185 0.1016075163 0.005740703 0.0008309164
## KOJA 0.11573338 0.1515565894 0.302622683 0.1773127435
## KRAMAT JATI 0.27237959 0.0582101201 0.263848120 0.1872780780
## MAKASAR 0.27694544 0.0368511726 0.133097361 0.2272449554
## MAMPANG PRAPATAN 0.28165521 0.1074303646 0.193064943 0.1131982241
## MATRAMAN 0.52963631 0.1379692684 0.397744797 0.1781348867
## MENTENG 0.83416971 0.0552943976 0.112462323 0.2590344038
## PADEMANGAN 0.37526201 0.0496502977 0.068453690 0.6008699734
## PALMERAH 0.36869987 0.0625194532 0.339492237 0.2156031761
## PANCORAN 0.33765364 0.0724668682 0.190966523 0.1463418690
## PASAR MINGGU 0.29890696 0.0804867947 0.175890759 0.1242946668
## PASAR REBO 0.21261087 0.0834344558 0.131811950 0.2019375162
## PENJARINGAN 0.51936571 0.0666555308 0.097465293 0.8476094384
## PESANGGRAHAN 0.30645587 0.0303718886 0.156469245 0.1522999510
## PULO GADUNG 0.48299608 0.0184031258 0.244272562 0.3293973709
## SAWAH BESAR 0.69589161 0.0547545557 0.256156194 0.7842069295
## SENEN 0.99188382 0.0000000000 0.316469519 0.3732324801
## SETIA BUDI 0.48484996 0.0626582302 0.190345212 0.2883474777
## TAMAN SARI 0.97311418 0.0701389965 0.374557766 0.8181733890
## TAMBORA 0.52079335 0.1812186249 1.000000000 0.7715701940
## TANAH ABANG 0.53646375 0.0356037914 0.277302999 0.2047164235
## TANJUNG PRIOK 0.31562520 0.0214875395 0.254513059 0.4292834239
## TEBET 0.54628073 0.0718972005 0.353443480 0.1624596255
## pendidikan_rendah RS_covid rasio_ketergantungan WNA
## CAKUNG 0.39375972 0.2 0.0000000 0.02791648
## CEMPAKA PUTIH 0.07651272 1.0 0.3783785 0.26055028
## CENGKARENG 0.56771177 0.2 0.3378379 0.08747682
## CILANDAK 0.17701898 0.4 0.2756758 0.62736589
## CILINCING 0.63079053 0.6 0.6486488 0.01321321
## CIPAYUNG 0.24071021 0.2 0.3851352 0.02162390
## CIRACAS 0.21319123 0.6 0.3729731 0.01530894
## DUREN SAWIT 0.20389751 0.4 0.5328187 0.05099042
## GAMBIR 0.19178045 0.4 0.2837839 0.26550032
## GROGOL PETAMBURAN 0.24793560 0.4 0.3938225 0.34915490
## JAGAKARSA 0.23341617 0.6 0.4189190 0.11345539
## JATINEGARA 0.31177014 0.6 0.4155407 0.07824720
## JOHAR BARU 0.47621723 0.2 0.4459461 0.03648000
## KALI DERES 0.64581338 0.8 0.3405406 0.05601652
## KEBAYORAN BARU 0.13596285 0.6 0.2270271 1.00000000
## KEBAYORAN LAMA 0.24036486 0.6 0.3513512 0.43515709
## KEBON JERUK 0.28530877 0.8 0.4285712 0.17225544
## KELAPA GADING 0.00000000 0.4 0.4864866 0.81678385
## KEMAYORAN 0.24647624 0.4 0.4763515 0.32742857
## KEMBANGAN 0.31609960 0.2 0.4324323 0.17010550
## KEP. SERIBU SLT 1.00000000 0.0 1.0000000 0.00000000
## KEP. SERIBU UTR 0.92883448 0.0 0.6216221 0.00000000
## KOJA 0.49707979 0.8 0.5540539 0.01806629
## KRAMAT JATI 0.24489384 0.4 0.4401544 0.03204303
## MAKASAR 0.12765378 0.8 0.3567569 0.01079856
## MAMPANG PRAPATAN 0.26515178 0.6 0.2594595 0.71201311
## MATRAMAN 0.13159830 0.0 0.2567571 0.03043262
## MENTENG 0.20089743 0.6 0.3729731 0.31571294
## PADEMANGAN 0.49411514 0.2 0.4054055 0.44307301
## PALMERAH 0.34164700 1.0 0.3918917 0.17895360
## PANCORAN 0.18035158 0.2 0.3513512 0.23031011
## PASAR MINGGU 0.19788584 0.0 0.3706566 0.22487100
## PASAR REBO 0.16294857 0.2 0.3405406 0.03299218
## PENJARINGAN 0.51267632 0.8 0.4702704 0.39467162
## PESANGGRAHAN 0.19840256 0.2 0.4216217 0.10437702
## PULO GADUNG 0.18596875 0.8 0.3474901 0.09863555
## SAWAH BESAR 0.29192252 0.8 0.3891893 0.66333949
## SENEN 0.39957690 0.4 0.3918917 0.13487199
## SETIA BUDI 0.20894129 0.8 0.1824325 0.73106269
## TAMAN SARI 0.41287483 0.0 0.3648650 0.23595669
## TAMBORA 0.62873093 0.0 0.3169533 0.09929640
## TANAH ABANG 0.31092262 0.2 0.4401544 0.39496991
## TANJUNG PRIOK 0.30441051 0.4 0.4169888 0.27713880
## TEBET 0.15175607 0.2 0.3474901 0.17402304
## RS tenaga_kesehatan apotek puskesmas balita
## CAKUNG 0.1428571 0.500000000 0.5123967 0.54545455 0.009841763
## CEMPAKA PUTIH 0.2857143 0.686742694 0.3884298 0.09090909 0.075914343
## CENGKARENG 0.1428571 0.690662865 1.0000000 0.63636364 0.000000000
## CILANDAK 0.4285714 0.468282252 0.3223140 0.27272727 0.043761764
## CILINCING 0.1428571 0.461867427 0.5289256 0.63636364 0.036191213
## CIPAYUNG 0.0000000 0.462936565 0.4628099 0.72727273 0.074178783
## CIRACAS 0.1428571 0.462936565 0.4958678 0.27272727 0.023405997
## DUREN SAWIT 0.2857143 0.514967926 0.4958678 0.81818182 0.022745675
## GAMBIR 0.1428571 0.523164647 0.2975207 0.09090909 0.201570822
## GROGOL PETAMBURAN 0.4285714 0.641126158 0.9090909 0.63636364 0.079134901
## JAGAKARSA 0.4285714 0.384176764 0.2561983 0.27272727 0.028414764
## JATINEGARA 0.2857143 0.581967213 0.5702479 0.81818182 0.058632709
## JOHAR BARU 0.0000000 0.727726301 0.4049587 0.36363636 0.073544373
## KALI DERES 0.1428571 0.432287954 0.5867769 0.90909091 0.007745482
## KEBAYORAN BARU 0.4285714 0.562722737 0.3553719 0.72727273 0.219304220
## KEBAYORAN LAMA 0.2857143 0.510334996 0.3388430 0.54545455 0.025088598
## KEBON JERUK 0.5714286 0.536707056 0.7603306 0.45454545 0.042268431
## KELAPA GADING 0.2857143 0.269422666 0.3223140 0.18181818 0.042495989
## KEMAYORAN 0.1428571 0.618674269 0.3223140 0.45454545 0.084610991
## KEMBANGAN 0.1428571 0.498218104 0.7190083 0.54545455 0.042967904
## KEP. SERIBU SLT 0.0000000 0.000000000 0.0000000 0.09090909 1.000000000
## KEP. SERIBU UTR 0.1428571 0.004632929 0.0000000 0.18181818 0.723281640
## KOJA 0.4285714 0.481824661 0.5537190 0.45454545 0.043182219
## KRAMAT JATI 0.2857143 0.395937277 0.3884298 0.54545455 0.050592620
## MAKASAR 0.4285714 0.410548824 0.4132231 0.36363636 0.053716405
## MAMPANG PRAPATAN 0.0000000 0.447255880 0.3223140 0.36363636 0.089362525
## MATRAMAN 0.0000000 0.410548824 0.4380165 0.36363636 0.087608985
## MENTENG 0.4285714 0.523164647 0.2892562 0.00000000 0.183247286
## PADEMANGAN 0.1428571 0.408766928 0.5041322 0.18181818 0.037310872
## PALMERAH 0.2857143 0.250534569 0.3305785 0.63636364 0.069164650
## PANCORAN 0.1428571 0.405203136 0.2644628 0.54545455 0.100708702
## PASAR MINGGU 0.2857143 0.510334996 0.3305785 0.63636364 0.045662406
## PASAR REBO 0.1428571 0.418032787 0.4462810 0.27272727 0.052275029
## PENJARINGAN 0.4285714 0.495010691 0.5785124 0.36363636 0.023968228
## PESANGGRAHAN 0.1428571 0.415894512 0.2975207 0.27272727 0.035113105
## PULO GADUNG 1.0000000 0.395937277 0.3471074 0.54545455 0.047895019
## SAWAH BESAR 0.5714286 0.618674269 0.3388430 0.00000000 0.116881896
## SENEN 0.1428571 0.618674269 0.3305785 0.36363636 0.144390253
## SETIA BUDI 0.5714286 0.426229508 0.2892562 0.18181818 0.243184902
## TAMAN SARI 0.0000000 0.382751247 0.5785124 0.27272727 0.216024889
## TAMBORA 0.0000000 0.294725588 0.4214876 0.54545455 0.127008026
## TANAH ABANG 0.0000000 1.000000000 0.5785124 0.27272727 0.118377486
## TANJUNG PRIOK 0.7142857 0.548111190 0.5702479 1.00000000 0.033125160
## TEBET 0.2857143 0.520669993 0.3471074 0.54545455 0.074944866
## positif_cov rawat_cov isoman_cov covidfcm.cluster
## CAKUNG 0.816213530 0.57746479 0.58285714 2
## CEMPAKA PUTIH 0.337616242 0.35211268 0.09714286 1
## CENGKARENG 0.908213246 0.76760563 0.83428571 2
## CILANDAK 0.564988997 0.43661972 0.65142857 1
## CILINCING 0.543550792 0.51408451 0.36000000 2
## CIPAYUNG 0.723716902 0.44366197 0.70857143 2
## CIRACAS 0.659260311 0.51408451 0.61714286 2
## DUREN SAWIT 1.000000000 0.97887324 0.82857143 2
## GAMBIR 0.252289345 0.17605634 0.24000000 1
## GROGOL PETAMBURAN 0.571874778 0.47183099 0.24571429 1
## JAGAKARSA 0.819407965 0.56338028 1.00000000 2
## JATINEGARA 0.618016611 0.38732394 0.49714286 2
## JOHAR BARU 0.279477532 0.17605634 0.10857143 1
## KALI DERES 0.553489032 0.51408451 0.28571429 2
## KEBAYORAN BARU 0.434585078 0.38732394 0.56000000 1
## KEBAYORAN LAMA 0.648328246 0.53521127 0.47428571 2
## KEBON JERUK 0.727408249 0.71830986 0.41714286 2
## KELAPA GADING 0.402995670 0.42957746 0.34285714 1
## KEMAYORAN 0.686945411 0.60563380 0.36000000 2
## KEMBANGAN 0.627457940 0.47183099 0.43428571 2
## KEP. SERIBU SLT 0.000000000 0.00000000 0.00000000 1
## KEP. SERIBU UTR 0.005324058 0.02112676 0.02285714 1
## KOJA 0.586569177 0.47887324 0.26857143 2
## KRAMAT JATI 0.701000923 0.69014085 0.49714286 2
## MAKASAR 0.604103074 0.41549296 0.59428571 2
## MAMPANG PRAPATAN 0.392489529 0.16901408 0.25142857 1
## MATRAMAN 0.437282601 0.33098592 0.21142857 1
## MENTENG 0.212962306 0.23239437 0.09714286 1
## PADEMANGAN 0.340171790 0.34507042 0.29714286 1
## PALMERAH 0.530063179 0.38028169 0.24571429 2
## PANCORAN 0.438631362 0.50000000 0.35428571 2
## PASAR MINGGU 0.797330872 0.64084507 0.75428571 2
## PASAR REBO 0.563214311 0.35915493 0.46857143 2
## PENJARINGAN 0.553134095 0.92253521 0.50285714 2
## PESANGGRAHAN 0.507844112 0.29577465 0.23428571 1
## PULO GADUNG 0.685667637 0.75352113 0.48571429 2
## SAWAH BESAR 0.271881877 0.33802817 0.14285714 1
## SENEN 0.300631788 0.25352113 0.21142857 1
## SETIA BUDI 0.371690211 0.43661972 0.33714286 1
## TAMAN SARI 0.260168950 0.42957746 0.16000000 1
## TAMBORA 0.397813587 0.48591549 0.24000000 1
## TANAH ABANG 0.396180876 0.45070423 0.16571429 1
## TANJUNG PRIOK 0.869596081 1.00000000 0.51428571 2
## TEBET 0.542485980 0.38028169 0.37714286 1
now let’s see it through visualization
covid_lust <- ppclust2(covidfcm, "fanny")
fviz_cluster(covid_lust, data = datacovidfcm,
ellipse.type = "convex",
ellipse.level = 0.5,
labelsize = 7,
palette = "Dark2",
repel = T)
now lets do some cluster profiling
covidfcm$v
## lansia disabilitas kepadatan_penduduk penduduk_nonmuslim
## Cluster 1 0.4591629 0.1166271 0.2285354 0.3414606
## Cluster 2 0.3936909 0.1188795 0.2254411 0.3127655
## pendidikan_rendah RS_covid rasio_ketergantungan WNA RS
## Cluster 1 0.3231679 0.4199911 0.3947412 0.2578983 0.2493198
## Cluster 2 0.3224934 0.4433548 0.3979552 0.2177715 0.2695025
## tenaga_kesehatan apotek puskesmas balita positif_cov rawat_cov
## Cluster 1 0.4781012 0.4209334 0.4023419 0.1220504 0.4878545 0.4355515
## Cluster 2 0.4732257 0.4426290 0.4594368 0.1009901 0.5536850 0.4875869
## isoman_cov
## Cluster 1 0.3583740
## Cluster 2 0.4168333
in cluster 1, we can help the old as variable lansia shows us a high vulnerability towards covid. We need to take a preventive action in this cluster. As for cluster 2, we need to cure the ones who infected covid as positif_cov variable is dominant in this cluster.