Professional Documents
Culture Documents
R
him26
2021-08-20
library("ggplot2")
library("dplyr")
##
## Attaching package: 'dplyr'
library("ggfortify")
library(readxl)
data1 <-
read_excel("C:/Users/him26/Downloads/Saggraha/SaggrahaDataClustering.xlsm")
View(data1)
summary(data1)
## Mean :179.50
## 3rd Qu.:268.75
## Max. :358.00
## 1st Qu.:-1.0000
## Median : 0.0000
## Mean :-0.2374
## Max. : 1.0000
## 24. Did you invest any of the last loan you took from the program into an
income-generating activity
## Min. :0.000
## 1st Qu.:0.000
## Median :1.500
## Mean :1.042
## 3rd Qu.:2.000
## Max. :2.000
## 25. Over the last 12 months, has the household income you have been able
to earn.
## Min. :-2.0000
## 1st Qu.:-1.0000
## Median :-1.0000
## Mean :-0.7067
## Max. : 2.0000
## 32.1. Do you feel that productivity has increased after taking loan from
Saggraha MFI
## Min. :-1.0000
## Median : 1.0000
## Mean : 0.9022
## Max. : 2.0000
## 32.2. Do you feel that quality of life has improved after taking loan
from Saggraha MFI:
## Min. :-2.0000
## Median : 1.0000
## Mean : 0.8994
## Max. : 2.0000
## 32.3. Do you feel yourself more financially secure after taking loan from
Saggraha MFI:
## Min. :-2.000
## Median : 1.000
## Mean : 0.824
## 32.4. Do you feel yourself and household members more healthy due to
better food and hygienic living conditions due to increase in income after
taking loan from Saggraha MFI
## Min. :-2.0000
## Median : 1.0000
## Mean : 0.8492
## Max. : 2.0000
## 32.5. Do you feel you have better coping capacity during emergency after
taking loan from Saggraha MFI:
## Min. :-1.0000
## Median : 1.0000
## Mean : 0.6927
## Max. : 2.0000
## 32.6. Do you feel your overall peace of mind has improved due to loan
provided by Saggraha MFI:
## Min. :-2.0000
## Median : 1.0000
## Mean : 0.6732
## Max. : 2.0000
## 34.1. Lower interest rate than other informal sources of credit (informal
lenders)
## Min. :-2.0000
## Median : 1.0000
## Mean : 0.6257
## Max. : 2.0000
## 1st Qu.:-1.0000
## Median : 1.0000
## Mean : 0.3631
## Max. : 2.0000
## 1st Qu.:-1.00000
## Median : 0.00000
## Mean : 0.00838
## Max. : 2.00000
## 1st Qu.:-1.0000
## Median : 0.0000
## Mean :-0.2374
## Max. : 1.0000
## 24. Did you invest any of the last loan you took from the program into an
income-generating activity
## Min. :0.000
## 1st Qu.:0.000
## Median :1.500
## Mean :1.042
## 3rd Qu.:2.000
## Max. :2.000
## 25. Over the last 12 months, has the household income you have been able
to earn.
## Min. :-2.0000
## 1st Qu.:-1.0000
## Median :-1.0000
## Mean :-0.7067
## 32.1. Do you feel that productivity has increased after taking loan from
Saggraha MFI
## Min. :-1.0000
## Median : 1.0000
## Mean : 0.9022
## Max. : 2.0000
## 32.2. Do you feel that quality of life has improved after taking loan
from Saggraha MFI:
## Min. :-2.0000
## Median : 1.0000
## Mean : 0.8994
## Max. : 2.0000
## 32.3. Do you feel yourself more financially secure after taking loan from
Saggraha MFI:
## Min. :-2.000
## Median : 1.000
## Mean : 0.824
## Max. : 2.000
## 32.4. Do you feel yourself and household members more healthy due to
better food and hygienic living conditions due to increase in income after
taking loan from Saggraha MFI
## Min. :-2.0000
## 1st Qu.: 1.0000
## Median : 1.0000
## Mean : 0.8492
## Max. : 2.0000
## 32.5. Do you feel you have better coping capacity during emergency after
taking loan from Saggraha MFI:
## Min. :-1.0000
## Median : 1.0000
## Mean : 0.6927
## Max. : 2.0000
## 32.6. Do you feel your overall peace of mind has improved due to loan
provided by Saggraha MFI:
## Min. :-2.0000
## Median : 1.0000
## Mean : 0.6732
## Max. : 2.0000
## 34.1. Lower interest rate than other informal sources of credit (informal
lenders)
## Min. :-2.0000
## Median : 1.0000
## Mean : 0.6257
## 3rd Qu.: 1.0000
## Max. : 2.0000
## 1st Qu.:-1.0000
## Median : 1.0000
## Mean : 0.3631
## Max. : 2.0000
## 1st Qu.:-1.00000
## Median : 0.00000
## Mean : 0.00838
## Max. : 2.00000
#kmean_withinss(2)
max_k <-20
# Run algorithm over a range of k
wss <- sapply(2:max_k, kmean_withinss)
pc_cluster_2 <-kmeans(data2, 4)
pc_cluster_2$cluster
## [1] 3 3 1 2 4 4 3 4 3 2 4 3 2 2 4 4 4 4 3 4 3 3 3 4 3 4 3 2 2 2 2 2 2 2
2 2 2
## [38] 4 4 4 4 4 4 4 4 4 3 3 3 4 4 4 4 2 2 2 3 3 4 3 4 4 4 4 4 3 3 4 4 4 4
3 4 4
## [75] 4 2 3 3 4 1 4 4 3 3 4 2 3 4 4 4 3 3 3 3 4 1 1 1 2 3 1 3 3 4 2 2 1 1
4 4 4
## [112] 1 1 1 1 1 4 3 3 4 3 1 1 1 2 3 3 3 1 3 3 3 3 3 2 2 3 2 4 4 4 4 4 4 4
4 2 2
## [149] 2 2 2 2 2 2 2 2 3 4 3 3 3 4 4 4 4 4 2 2 2 2 2 2 2 3 4 3 2 2 2 4 4 3
3 3 4
## [186] 3 2 3 3 3 3 4 4 3 3 4 4 4 3 4 3 3 3 3 4 3 3 4 3 4 4 4 4 3 3 4 4 4 4
4 2 3
## [223] 1 3 1 3 1 3 3 4 3 3 3 2 2 2 2 2 2 3 3 3 4 3 3 4 4 4 4 4 4 3 4 3 4 2
2 2 2
## [260] 2 2 3 4 4 3 3 3 3 3 1 3 3 3 1 1 1 4 4 4 3 4 1 4 3 4 4 4 4 4 1 3 4 3
4 3 4
## [297] 3 3 3 3 3 3 4 3 4 4 2 2 2 2 2 2 3 4 3 1 1 1 4 4 4 1 4 4 4 4 4 4 4 4
3 3 3
## [334] 3 4 4 4 4 2 2 3 2 4 4 4 3 3 3 1 4 4 4 4 3 4 3 4 3
pc_cluster_2$size
pc_cluster_2$centers