Introduction

The all.us.crime.1970 dataset from cluster.dataset package records city crime along with population statistics. All rate variables are per 100,000 population.

Number of Attributes : 10

Number of Instances : 27

Data Set Characteristics: Multivariate

Attribute Characteristics: Integer

Objective

The major aim is to perform clustering analysis using algorithms like hClust,kMeans,mclust,CLARA,Agnes and provide inferences accordingly to segment crimes based on their rates in the various cities according to the distribution of population which may be used to detect the crimes.

Attribute Information

Number of Attributes: 10 Number of Instances : 27

ATTRIBUTES DESCRIPTION
City Character vector for the city name
Population Numeric vector for th epopulation in thousands
white.change Numeric vector for the % change in inner city white population from 1960 to 1970
black.population Numeric vector for the black population in thousands
Murder Numeric vector for the murder rate
Rape Numeric vector for the rape rate
Robbery Numeric vector for the robbery rate
Assault Numeric vector for the assault rate
Burglary Numeric vector for the burglary rate
Car Theft Numeric vector for the Car theft rate

Loading the data and finding the summary

## [1] "C:/Users/admin/Documents/PA 2 Project"
##      city             population     white.change     black.population
##  Length:24          Min.   : 1268   Min.   :-39.400   Min.   :  39.0  
##  Class :character   1st Qu.: 1416   1st Qu.:-20.875   1st Qu.: 117.5  
##  Mode  :character   Median : 2024   Median :-13.450   Median : 302.0  
##                     Mean   : 2932   Mean   : -8.304   Mean   : 452.8  
##                     3rd Qu.: 2923   3rd Qu.:  6.750   3rd Qu.: 585.5  
##                     Max.   :11529   Max.   : 50.800   Max.   :2080.0  
##      murder            rape          robbery         assault     
##  Min.   : 2.600   Min.   : 5.70   Min.   : 53.0   Min.   : 63.0  
##  1st Qu.: 4.400   1st Qu.:16.40   1st Qu.:142.8   1st Qu.:106.8  
##  Median : 9.350   Median :20.20   Median :243.0   Median :157.0  
##  Mean   : 9.188   Mean   :23.18   Mean   :277.9   Mean   :187.8  
##  3rd Qu.:13.525   3rd Qu.:28.10   3rd Qu.:351.8   3rd Qu.:232.2  
##  Max.   :18.400   Max.   :50.00   Max.   :665.0   Max.   :421.0  
##     burglary      car.theft     
##  Min.   : 499   Min.   : 348.0  
##  1st Qu.: 854   1st Qu.: 523.2  
##  Median :1333   Median : 684.0  
##  Mean   :1313   Mean   : 679.6  
##  3rd Qu.:1660   3rd Qu.: 795.8  
##  Max.   :2164   Max.   :1208.0
## 'data.frame':    24 obs. of  10 variables:
##  $ city            : chr  "Anaheim" "Baltimore" "Boston" "Buffalo" ...
##  $ population      : num  1420 2071 2754 1349 6979 ...
##  $ white.change    : num  50.8 -21.4 -16.5 -20.7 -18.6 -17.2 -26.5 14.2 -29.1 25.5 ...
##  $ black.population: num  39 501 151 118 1306 ...
##  $ murder          : num  2.7 13.2 4.4 5.7 12.9 6.4 14.5 18.4 14.7 16.9 ...
##  $ rape            : num  21.9 34.9 14.8 13.7 25.4 16.8 18.7 41 31.1 27.1 ...
##  $ robbery         : num  94 564 136 145 363 120 288 206 649 335 ...
##  $ assault         : num  103 396 95 111 233 107 132 338 223 183 ...
##  $ burglary        : num  1607 1351 1054 862 830 ...
##  $ car.theft       : num  377 701 984 448 708 ...

Algorithm 1:hClust

##         
## groups.5 Anaheim Baltimore Boston Buffalo Chicago Cincinnatti Cleveland
##        1       1         0      1       1       0           1         0
##        2       0         1      0       0       0           0         0
##        3       0         0      0       0       1           0         1
##         
## groups.5 Dallas Detroit Houston Los Angeles Miami Milwaukee Minneapolis
##        1      0       0       0           0     0         1           1
##        2      0       1       0           0     0         0           0
##        3      1       0       1           1     1         0           0
##         
## groups.5 New York Newark Paterson Philadelphia Pittsburgh San Diego
##        1        0      0        1            1          1         1
##        2        1      0        0            0          0         0
##        3        0      1        0            0          0         0
##         
## groups.5 San Francisco Seattle St Louis Washington
##        1             0       1        0          0
##        2             0       0        0          1
##        3             1       0        1          0

The above plot represents the dendogram based on robbery and murder and the one below shows the dendogram based on robbery and car.theft.

##         
## groups.3 Anaheim Baltimore Boston Buffalo Chicago Cincinnatti Cleveland
##        1       1         0      0       1       0           1         0
##        2       0         1      0       0       0           0         0
##        3       0         0      1       0       1           0         1
##         
## groups.3 Dallas Detroit Houston Los Angeles Miami Milwaukee Minneapolis
##        1      1       0       0           0     0         1           1
##        2      0       1       0           0     0         0           0
##        3      0       0       1           1     1         0           0
##         
## groups.3 New York Newark Paterson Philadelphia Pittsburgh San Diego
##        1        0      0        1            1          1         1
##        2        1      0        0            0          0         0
##        3        0      1        0            0          0         0
##         
## groups.3 San Francisco Seattle St Louis Washington
##        1             0       1        0          0
##        2             0       0        0          1
##        3             1       0        1          0

Considering all the continuous variables and renmoving the discrete ones we plot the dendogram for the all.us.city.crime.1970 data and provide inferences as below.

## groups.3_cc
##  1  2  3 
## 10  7  7
##  [1] "Anaheim"      "Buffalo"      "Cincinnatti"  "Milwaukee"   
##  [5] "Minneapolis"  "Paterson"     "Philadelphia" "Pittsburgh"  
##  [9] "San Diego"    "Seattle"
## [[1]]
##  [1] "Anaheim"      "Buffalo"      "Cincinnatti"  "Milwaukee"   
##  [5] "Minneapolis"  "Paterson"     "Philadelphia" "Pittsburgh"  
##  [9] "San Diego"    "Seattle"     
## 
## [[2]]
## [1] "Baltimore"     "Dallas"        "Detroit"       "Los Angeles"  
## [5] "Miami"         "New York"      "San Francisco"
## 
## [[3]]
## [1] "Boston"     "Chicago"    "Cleveland"  "Houston"    "Newark"    
## [6] "St Louis"   "Washington"
##            
## groups.3_cc Anaheim Baltimore Boston Buffalo Chicago Cincinnatti Cleveland
##           1       1         0      0       1       0           1         0
##           2       0         1      0       0       0           0         0
##           3       0         0      1       0       1           0         1
##            
## groups.3_cc Dallas Detroit Houston Los Angeles Miami Milwaukee Minneapolis
##           1      0       0       0           0     0         1           1
##           2      1       1       0           1     1         0           0
##           3      0       0       1           0     0         0           0
##            
## groups.3_cc New York Newark Paterson Philadelphia Pittsburgh San Diego
##           1        0      0        1            1          1         1
##           2        1      0        0            0          0         0
##           3        0      1        0            0          0         0
##            
## groups.3_cc San Francisco Seattle St Louis Washington
##           1             0       1        0          0
##           2             1       0        0          0
##           3             0       0        1          1
##            
## groups.3_cc 1268 1349 1358 1359 1385 1404 1420 1422 1556 1814 1857 1985
##           1    0    1    1    1    1    1    1    1    0    1    0    0
##           2    1    0    0    0    0    0    0    0    1    0    0    0
##           3    0    0    0    0    0    0    0    0    0    0    1    1
##            
## groups.3_cc 2064 2071 2363 2401 2754 2861 3110 4200 4818 6979 7032 11529
##           1    0    0    0    1    0    0    0    0    1    0    0     0
##           2    0    1    0    0    0    0    1    1    0    0    1     1
##           3    1    0    1    0    1    1    0    0    0    1    0     0

The table function can be used, this time passing two arguments, to produce a cross-tabulation of cluster group membership and population.

Algorithm 2:Agglomerative Nesting (Hierarchial Clustering)

## Call:     agnes(x = all.us.city.crime.1970, metric = "euclidean", method = "complete") 
## Agglomerative coefficient:  0.9199728 
## Order of objects:
##  [1]  1 23  8 12  4 17  6 22 13  2 10 16 20 14  3 19  7  9 21 24 18  5 11
## [24] 15
## Height (summary):
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   105.5   489.1   787.5  1611.0  1564.0 11010.0 
## 
## Available components:
## [1] "order"  "height" "ac"     "merge"  "diss"   "call"   "method" "data"

## Call:     agnes(x = data_usc, metric = "euclidean", method = "complete") 
## Agglomerative coefficient:  0.8619738 
## Order of objects:
##  [1]  1 23  2 24  8 10 20 14 16  9 15 12 11 21  3  7  4 17 18 19  6 22  5
## [24] 13
## Height (summary):
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   66.39  212.60  337.40  448.40  497.40 1787.00 
## 
## Available components:
## [1] "order"  "height" "ac"     "merge"  "diss"   "call"   "method" "data"

## groups_3
##  1  2  3 
##  9 10  5
##         
## groups_3 Anaheim Baltimore Boston Buffalo Chicago Cincinnatti Cleveland
##        1       1         1      0       0       0           0         0
##        2       0         0      1       1       1           1         1
##        3       0         0      0       0       0           0         0
##         
## groups_3 Dallas Detroit Houston Los Angeles Miami Milwaukee Minneapolis
##        1      1       0       1           0     0         0           1
##        2      0       0       0           0     0         1           0
##        3      0       1       0           1     1         0           0
##         
## groups_3 New York Newark Paterson Philadelphia Pittsburgh San Diego
##        1        0      1        0            0          0         0
##        2        0      0        1            1          1         1
##        3        1      0        0            0          0         0
##         
## groups_3 San Francisco Seattle St Louis Washington
##        1             0       1        1          1
##        2             0       0        0          0
##        3             1       0        0          0
##         
## groups_3 1268 1349 1358 1359 1385 1404 1420 1422 1556 1814 1857 1985 2064
##        1    0    0    0    0    0    0    1    1    1    1    1    1    0
##        2    0    1    1    1    1    1    0    0    0    0    0    0    1
##        3    1    0    0    0    0    0    0    0    0    0    0    0    0
##         
## groups_3 2071 2363 2401 2754 2861 3110 4200 4818 6979 7032 11529
##        1    1    1    0    0    1    0    0    0    0    0     0
##        2    0    0    1    1    0    0    0    1    1    0     0
##        3    0    0    0    0    0    1    1    0    0    1     1

Algorithm 3:kMeans

## [1] 10
##  [1] "city"             "population"       "white.change"    
##  [4] "black.population" "murder"           "rape"            
##  [7] "robbery"          "assault"          "burglary"        
## [10] "car.theft"
##      city             population     white.change     black.population
##  Length:24          Min.   : 1268   Min.   :-39.400   Min.   :  39.0  
##  Class :character   1st Qu.: 1416   1st Qu.:-20.875   1st Qu.: 117.5  
##  Mode  :character   Median : 2024   Median :-13.450   Median : 302.0  
##                     Mean   : 2932   Mean   : -8.304   Mean   : 452.8  
##                     3rd Qu.: 2923   3rd Qu.:  6.750   3rd Qu.: 585.5  
##                     Max.   :11529   Max.   : 50.800   Max.   :2080.0  
##      murder            rape          robbery         assault     
##  Min.   : 2.600   Min.   : 5.70   Min.   : 53.0   Min.   : 63.0  
##  1st Qu.: 4.400   1st Qu.:16.40   1st Qu.:142.8   1st Qu.:106.8  
##  Median : 9.350   Median :20.20   Median :243.0   Median :157.0  
##  Mean   : 9.188   Mean   :23.18   Mean   :277.9   Mean   :187.8  
##  3rd Qu.:13.525   3rd Qu.:28.10   3rd Qu.:351.8   3rd Qu.:232.2  
##  Max.   :18.400   Max.   :50.00   Max.   :665.0   Max.   :421.0  
##     burglary      car.theft     
##  Min.   : 499   Min.   : 348.0  
##  1st Qu.: 854   1st Qu.: 523.2  
##  Median :1333   Median : 684.0  
##  Mean   :1313   Mean   : 679.6  
##  3rd Qu.:1660   3rd Qu.: 795.8  
##  Max.   :2164   Max.   :1208.0
##           murder  rape robbery assault burglary car.theft
## murder     1.000 0.526   0.638   0.709    0.353     0.495
## rape       0.526 1.000   0.414   0.667    0.694     0.410
## robbery    0.638 0.414   1.000   0.699    0.551     0.559
## assault    0.709 0.667   0.699   1.000    0.596     0.428
## burglary   0.353 0.694   0.551   0.596    1.000     0.382
## car.theft  0.495 0.410   0.559   0.428    0.382     1.000
##   Group.1     murder       rape    robbery    assault   burglary
## 1       1 -0.9128346 -0.6991864 -0.8438639 -0.8328348 -0.5708682
## 2       2  0.7723985  0.5916192  0.7140387  0.7047064  0.4830424
##    car.theft
## 1 -0.7166146
## 2  0.6063662
##                
##                 1 2
##   Anaheim       1 0
##   Baltimore     0 1
##   Boston        1 0
##   Buffalo       1 0
##   Chicago       0 1
##   Cincinnatti   1 0
##   Cleveland     0 1
##   Dallas        0 1
##   Detroit       0 1
##   Houston       0 1
##   Los Angeles   0 1
##   Miami         0 1
##   Milwaukee     1 0
##   Minneapolis   1 0
##   New York      0 1
##   Newark        0 1
##   Paterson      1 0
##   Philadelphia  1 0
##   Pittsburgh    1 0
##   San Diego     1 0
##   San Francisco 0 1
##   Seattle       1 0
##   St Louis      0 1
##   Washington    0 1

## K-means clustering with 3 clusters of sizes 17, 3, 4
## 
## Cluster means:
##   population white.change black.population    murder     rape  robbery
## 1   1754.706    -6.076471         207.7059  8.470588 20.51765 215.3529
## 2   8513.333    -7.733333        1470.6667 10.933333 31.76667 445.0000
## 3   3747.250   -18.200000         731.2500 10.925000 28.05000 418.5000
##    assault burglary car.theft
## 1 165.5294 1208.882  629.1176
## 2 296.6667 1544.000  866.6667
## 3 201.0000 1584.250  754.0000
## 
## Clustering vector:
##  [1] 1 1 1 1 2 1 1 1 3 1 2 1 1 1 2 1 1 3 1 1 3 1 1 3
## 
## Within cluster sum of squares by cluster:
## [1]  7816837 15138818  4039346
##  (between_SS / total_SS =  82.3 %)
## 
## Available components:
## 
## [1] "cluster"      "centers"      "totss"        "withinss"    
## [5] "tot.withinss" "betweenss"    "size"         "iter"        
## [9] "ifault"
##                
##                 1 2 3
##   Anaheim       1 0 0
##   Baltimore     1 0 0
##   Boston        1 0 0
##   Buffalo       1 0 0
##   Chicago       0 1 0
##   Cincinnatti   1 0 0
##   Cleveland     1 0 0
##   Dallas        1 0 0
##   Detroit       0 0 1
##   Houston       1 0 0
##   Los Angeles   0 1 0
##   Miami         1 0 0
##   Milwaukee     1 0 0
##   Minneapolis   1 0 0
##   New York      0 1 0
##   Newark        1 0 0
##   Paterson      1 0 0
##   Philadelphia  0 0 1
##   Pittsburgh    1 0 0
##   San Diego     1 0 0
##   San Francisco 0 0 1
##   Seattle       1 0 0
##   St Louis      1 0 0
##   Washington    0 0 1

###Inference:

Cities with low criminality makes up the black cluster, whereas the red cluster is composed of high criminality

Algortithm 4:CLARA

## Call:     clara(x = data[5:10], k = 3) 
## Medoids:
##      murder rape robbery assault burglary car.theft
## [1,]    9.5 20.5     333     182     1315       667
## [2,]    9.3 15.2     173     123      754       534
## [3,]   15.6 17.0     427     421     1858       781
## Objective function:   269.973
## Clustering vector:    int [1:24] 1 1 1 2 2 2 2 1 3 1 3 3 2 1 3 1 2 2 ...
## Cluster sizes:            9 9 6 
## Best sample:
##  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## [24] 24
## 
## Available components:
##  [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
##  [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"
## Object of class 'clara' from call:
##  clara(x = data[5:10], k = 3) 
## Medoids:
##      murder rape robbery assault burglary car.theft
## [1,]    9.5 20.5     333     182     1315       667
## [2,]    9.3 15.2     173     123      754       534
## [3,]   15.6 17.0     427     421     1858       781
## Objective function:    269.973 
## Numerical information per cluster:
##      size max_diss  av_diss isolation
## [1,]    9 482.4668 281.1015 0.8024201
## [2,]    9 687.6084 240.3805 1.1436036
## [3,]    6 481.9436 297.6690 0.7882187
## Average silhouette width per cluster:
## [1] 0.2951888 0.4720044 0.4074979
## Average silhouette width of best sample: 0.3895719 
## 
## Best sample:
##  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## [24] 24
## Clustering vector:
##  [1] 1 1 1 2 2 2 2 1 3 1 3 3 2 1 3 1 2 2 2 1 3 2 3 1
## 
## Silhouette plot information for best sample:
##    cluster neighbor   sil_width
## 16       1        2  0.48755135
## 20       1        3  0.43396962
## 24       1        3  0.38830077
## 10       1        3  0.38043351
## 2        1        3  0.35380456
## 8        1        3  0.28000182
## 1        1        3  0.23814081
## 14       1        2  0.13758391
## 3        1        2 -0.04308671
## 19       2        1  0.62921603
## 18       2        1  0.62602037
## 17       2        1  0.61044615
## 4        2        1  0.58526430
## 13       2        1  0.54401883
## 6        2        1  0.49983969
## 22       2        1  0.37379915
## 5        2        1  0.32675739
## 7        2        1  0.05267744
## 21       3        1  0.52770625
## 11       3        1  0.49349429
## 9        3        1  0.47305853
## 12       3        1  0.39665116
## 15       3        1  0.36446554
## 23       3        1  0.18961179
## 
## 276 dissimilarities, summarized :
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
##   66.389  460.020  696.110  731.100  937.650 1786.500 
## Metric :  euclidean 
## Number of objects : 24
## 
## Available components:
##  [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
##  [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"

Algorithm 5:mclust

## 'Mclust' model object:
##  best model: ellipsoidal, equal shape (VEV) with 4 components
## ----------------------------------------------------
## Gaussian finite mixture model fitted by EM algorithm 
## ----------------------------------------------------
## 
## Mclust VEV (ellipsoidal, equal shape) model with 4 components:
## 
##  log.likelihood  n df       BIC       ICL
##       -607.1122 24 96 -1519.318 -1519.318
## 
## Clustering table:
## 1 2 3 4 
## 7 6 6 5

Algorithm 6:PAM

##            1         2         3         4         5         6         7
## 2  7.0308561                                                            
## 3  5.2488400 5.3590882                                                  
## 4  4.8716309 5.2804642 2.4134045                                        
## 5  6.9898482 3.7654447 4.9517366 4.9549652                              
## 6  4.5734995 5.2618361 2.8405497 0.6771276 4.9092908                    
## 7  6.6880708 4.5876550 2.2690226 3.8310250 4.2505945 4.2002179          
## 8  4.8997671 3.6017432 5.4140987 5.2488027 5.0349737 4.9483850 5.3945913
## 9  7.3462937 2.4302016 5.1700094 5.2778270 3.2068605 5.3000970 4.1881408
## 10 3.7394131 4.2066241 4.1726356 4.4226428 4.3896903 4.2723460 4.2481896
## 11 7.0791470 3.8304825 6.5337704 7.0513924 4.3747185 6.8680610 6.0124973
## 12 5.3409094 3.5874176 4.8432804 4.9904929 5.1172569 5.0657095 4.7574384
## 13 4.6078839 6.4308707 2.8941509 1.3683489 5.6717709 1.5174153 4.5886690
## 14 4.0481289 5.2130719 1.8207676 1.3892531 5.1136229 1.5748902 3.5931716
## 15 9.3813553 6.0690077 7.8293296 8.2153614 3.8728557 8.2518439 6.9572007
## 16 6.2061779 3.4745764 2.7779155 2.4703294 3.6263307 2.6888114 2.7334020
## 17 4.5553539 6.4073442 2.5859034 1.4718615 5.7463020 1.8014950 4.4011837
## 18 4.2179741 5.3620524 3.7882680 3.4348947 3.4076695 3.2857304 4.4458517
## 19 4.8024216 5.2425516 2.0459068 0.5582254 4.7543623 1.0101958 3.5426962
## 20 6.4349408 2.9035963 3.5618764 3.8967884 3.6610081 3.8941811 2.8476995
## 21 6.4123806 3.0412235 4.5793488 5.2478579 4.1273060 5.1732068 4.1084405
## 22 2.3670614 5.7789907 3.3397802 2.5819765 5.5168870 2.3007175 4.9048627
## 23 3.9610889 4.7626794 2.6630773 2.2297988 5.0468296 2.0814612 4.0243244
## 24 7.2353590 2.7515841 4.1152218 4.1693052 2.6997410 4.3257701 3.2378259
##            8         9        10        11        12        13        14
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9  4.8058120                                                            
## 10 2.7909915 4.3504945                                                  
## 11 3.6737219 4.4243764 4.5905369                                        
## 12 3.6371541 4.5927870 3.1038363 5.3026921                              
## 13 6.0213658 6.4212959 4.9282354 7.9060418 5.7046689                    
## 14 4.8876144 5.1637828 3.7463117 6.5803357 4.6267658 1.9532535          
## 15 7.8002572 4.9886798 6.7920808 5.8740141 7.0012985 8.8239306 8.1344560
## 16 4.7689097 3.1416350 4.2310350 5.7156178 4.3762309 3.7387625 2.7697398
## 17 6.1313942 6.2987261 4.8378430 7.9236233 5.4626312 0.7634715 1.7138857
## 18 4.8229518 5.1262797 3.1834429 5.8296101 4.7126785 3.4192794 3.3477519
## 19 5.2359869 5.2406702 4.2833107 6.8741739 4.9501331 1.3402396 1.2235223
## 20 3.6619815 2.8695561 3.8429677 4.3113100 4.5028920 5.0751642 3.7953418
## 21 3.5475506 2.9667665 3.8813611 2.8464166 4.7272085 6.3154474 4.7007332
## 22 4.3863304 6.0400161 3.2800305 6.5508341 4.6987840 2.4373719 1.9666898
## 23 4.1095839 4.6825939 3.4397376 5.8198425 4.4248443 3.0691990 1.4951835
## 24 5.1228251 1.7863617 4.5828480 5.0801027 4.5210991 5.3123395 4.3319410
##           15        16        17        18        19        20        21
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16 6.7231676                                                            
## 17 8.6876641 3.6572894                                                  
## 18 6.1424157 4.0038224 3.4980268                                        
## 19 8.0054474 2.4786837 1.4083116 3.1841351                              
## 20 6.8147307 2.1331120 5.0957190 4.6283559 3.8352438                    
## 21 6.4388349 3.6540407 6.2411168 5.2293300 5.1207803 2.1355418          
## 22 8.5140582 4.1935850 2.5103576 2.8923449 2.4861713 4.7622715 5.3481166
## 23 7.9978393 2.7670469 2.9249909 3.7075391 2.2993154 3.2748413 3.8685639
## 24 5.2198209 1.8743659 5.2068833 4.5047622 4.1001161 2.4941679 3.4423710
##           22        23
## 2                     
## 3                     
## 4                     
## 5                     
## 6                     
## 7                     
## 8                     
## 9                     
## 10                    
## 11                    
## 12                    
## 13                    
## 14                    
## 15                    
## 16                    
## 17                    
## 18                    
## 19                    
## 20                    
## 21                    
## 22                    
## 23 2.3183701          
## 24 5.5000909 4.1915731
## [1] "medoids"    "id.med"     "clustering" "objective"  "isolation" 
## [6] "clusinfo"   "silinfo"    "diss"       "call"
##         
## groups.3 1 2 3
##        1 1 0 8
##        2 4 7 1
##        3 1 2 0
##  [1] "Boston"        "Buffalo"       "Cincinnatti"   "Dallas"       
##  [5] "Houston"       "Los Angeles"   "Miami"         "Milwaukee"    
##  [9] "Minneapolis"   "New York"      "Paterson"      "Philadelphia" 
## [13] "Pittsburgh"    "San Francisco" "San Diego"     "Seattle"

Plotting Cluster Solutions:

It is always a good idea to look at the cluster results. First, considering all the variables except city and population details we find that the components show a point variability of 75.74%

And now if we consider only the cluster plot for the set of attributes like Murder,Robbery and car.theft as shown below represents a point variability of 88.25%.

Comparison of Algorithms - Clustering Validation:

## 
## Clustering Methods:
##  hierarchical kmeans pam clara agnes 
## 
## Cluster sizes:
##  2 3 4 5 6 
## 
## Validation Measures:
##                                  2       3       4       5       6
##                                                                   
## hierarchical Connectivity   5.8615  9.3044 16.1234 20.0956 21.5956
##              Dunn           0.2659  0.2659  0.3445  0.4874  0.4874
##              Silhouette     0.4635  0.4325  0.4254  0.4394  0.3854
## kmeans       Connectivity   6.2198 10.5294 16.9778 21.4079 23.5329
##              Dunn           0.2452  0.2459  0.4032  0.4634  0.4634
##              Silhouette     0.4815  0.4382  0.4411  0.4284  0.3845
## pam          Connectivity   5.8615 15.8738 18.2028 21.4079 25.6913
##              Dunn           0.2659  0.3092  0.2981  0.4634  0.4634
##              Silhouette     0.4635  0.3896  0.4203  0.4284  0.3878
## clara        Connectivity   5.8615 15.8738 18.2028 21.4079 28.9750
##              Dunn           0.2659  0.3092  0.2981  0.4634  0.2127
##              Silhouette     0.4635  0.3896  0.4203  0.4284  0.3240
## agnes        Connectivity   5.8615  9.3044 16.1234 20.0956 21.5956
##              Dunn           0.2659  0.2659  0.3445  0.4874  0.4874
##              Silhouette     0.4635  0.4325  0.4254  0.4394  0.3854
## 
## Optimal Scores:
## 
##              Score  Method       Clusters
## Connectivity 5.8615 hierarchical 2       
## Dunn         0.4874 hierarchical 5       
## Silhouette   0.4815 kmeans       2

Conclusion: