Geospatial Analysis3 - Spatially Constrained Clustering: ClustGeo method

Author

Imran Ibrahim

Published

March 26, 2024

Modified

March 27, 2024

Loading R packages

pacman::p_load(spdep, sp, tmap, sf, ClustGeo, 
               ggpubr, cluster, factoextra, NbClust,
               heatmaply, corrplot, psych, tidyverse, GGally)
ACLED_MMR <- read_csv("data/MMR.csv")
mmr_shp_mimu_2 <-  st_read(dsn = "data/geospatial3",  
                  layer = "mmr_polbnda_adm2_250k_mimu")
Reading layer `mmr_polbnda_adm2_250k_mimu' from data source 
  `C:\imranmi\ISSS608-VAA\Take-home-ex\Take-home-Ex4f\data\geospatial3' 
  using driver `ESRI Shapefile'
Simple feature collection with 80 features and 7 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 92.1721 ymin: 9.696844 xmax: 101.17 ymax: 28.54554
Geodetic CRS:  WGS 84
ACLED_MMR_1 <- ACLED_MMR %>%
  mutate(admin1 = case_when(
    admin1 == "Bago-East" ~ "Bago (East)",
    admin1 == "Bago-West" ~ "Bago (West)",
    admin1 == "Shan-North" ~ "Shan (North)",
    admin1 == "Shan-South" ~ "Shan (South)",
    admin1 == "Shan-East" ~ "Shan (East)",
    TRUE ~ as.character(admin1)
  ))
ACLED_MMR_1 <- ACLED_MMR_1 %>%
  mutate(admin2 = case_when(
    admin2 == "Yangon-East" ~ "Yangon (East)",
    admin2 == "Yangon-West" ~ "Yangon (West)",
    admin2 == "Yangon-North" ~ "Yangon (North)",
    admin2 == "Yangon-South" ~ "Yangon (South)",
    admin2 == "Mong Pawk (Wa SAD)" ~ "Tachileik",
    admin2 == "Nay Pyi Taw" ~ "Det Khi Na",
    admin2 == "Yangon" ~ "Yangon (West)",
    TRUE ~ as.character(admin2)
  ))
ACLED_MMR_1 <- ACLED_MMR_1 %>%
  filter(year >= 2020 & year <= 2023)
Data2 <- ACLED_MMR_1 %>%
    group_by(year, admin2, event_type) %>%
    summarise(Incidents = n(),
              Fatalities = sum(fatalities, na.rm = TRUE)) %>%
              
    ungroup()
library(tidyr)


years <- unique(Data2$year)
event_types <- unique(Data2$event_type)
districts <- unique(Data2$admin2)

# Using complete() to create all combinations of year, admin2, and event_type
# and replacing NA values with 0 for Incidents and Fatalities
Data2_complete <- Data2 %>%
  complete(year = years, admin2 = districts, event_type = event_types, fill = list(Incidents = 0, Fatalities = 0))
library(dplyr)
library(tidyr)

data2_summary <- Data2_complete %>%
  group_by(admin2, event_type, year) %>%
  summarise(Incidents = sum(Incidents), Fatalities = sum(Fatalities), .groups = 'drop')  # Summarize and drop grouping

# Now we'll spread this into a wider format
data2_long <- data2_summary %>%
  pivot_wider(
    names_from = c(event_type, year), 
    values_from = c(Incidents, Fatalities),
    names_glue = "{event_type}_{year}_{.value}"  
  )

Filtering the data set for just “Battles_2022_Incidents”

selected <- data2_long %>%
  select(admin2, Battles_2022_Incidents)
selected
# A tibble: 80 × 2
   admin2                      Battles_2022_Incidents
   <chr>                                        <int>
 1 Bago                                            12
 2 Bawlake                                         16
 3 Bhamo                                           54
 4 Danu Self-Administered Zone                     15
 5 Dawei                                          141
 6 Det Khi Na                                       0
 7 Falam                                           59
 8 Gangaw                                         143
 9 Hakha                                           43
10 Hinthada                                         6
# ℹ 70 more rows

Spatially Constrained Clustering: ClustGeo Method

Computing proximity matrix

In R, many packages provide functions to calculate distance matrix. We will compute the proximity matrix by using dist() of R.

dist() supports six distance proximity calculations, they are: euclidean, maximum, manhattan, canberra, binary and minkowski. The default is euclidean proximity matrix.

The code chunk below is used to compute the proximity matrix using euclidean method.

proxmat <- dist(selected, method = 'euclidean')
proxmat
            1          2          3          4          5          6          7
2    5.656854                                                                  
3   59.396970  53.740115                                                       
4    4.242641   1.414214  55.154329                                            
5  182.433550 176.776695 123.036580 178.190909                                 
6   16.970563  22.627417  76.367532  21.213203 199.404112                      
7   66.468037  60.811183   7.071068  62.225397 115.965512  83.438600           
8  185.261977 179.605122 125.865007 181.019336   2.828427 202.232539 118.793939
9   43.840620  38.183766  15.556349  39.597980 138.592929  60.811183  22.627417
10   8.485281  14.142136  67.882251  12.727922 190.918831   8.485281  74.953319
11   2.828427   8.485281  62.225397   7.071068 185.261977  14.142136  69.296465
12  16.970563  22.627417  76.367532  21.213203 199.404112   0.000000  83.438600
13  21.213203  15.556349  38.183766  16.970563 161.220346  38.183766  45.254834
14  38.183766  32.526912  21.213203  33.941125 144.249783  55.154329  28.284271
15 213.546248 207.889394 154.149278 209.303607  31.112698 230.516811 147.078210
16  31.112698  25.455844  28.284271  26.870058 151.320851  48.083261  35.355339
17 206.475180 200.818326 147.078210 202.232539  24.041631 223.445743 140.007143
18 108.894444 103.237590  49.497475 104.651804  73.539105 125.865007  42.426407
19  43.840620  38.183766  15.556349  39.597980 138.592929  60.811183  22.627417
20   1.414214   4.242641  57.982756   2.828427 181.019336  18.384776  65.053824
21  16.970563  22.627417  76.367532  21.213203 199.404112   0.000000  83.438600
22   8.485281  14.142136  67.882251  12.727922 190.918831   8.485281  74.953319
23  38.183766  32.526912  21.213203  33.941125 144.249783  55.154329  28.284271
24   7.071068  12.727922  66.468037  11.313708 189.504617   9.899495  73.539105
25   1.414214   4.242641  57.982756   2.828427 181.019336  18.384776  65.053824
26  14.142136  19.798990  73.539105  18.384776 196.575685   2.828427  80.610173
27  12.727922  18.384776  72.124892  16.970563 195.161472   4.242641  79.195959
28  11.313708   5.656854  48.083261   7.071068 171.119841  28.284271  55.154329
29 359.210245 353.553391 299.813275 354.967604 176.776695 376.180808 292.742207
30   5.656854  11.313708  65.053824   9.899495 188.090404  11.313708  72.124892
31   5.656854  11.313708  65.053824   9.899495 188.090404  11.313708  72.124892
32  46.669048  41.012193  12.727922  42.426407 135.764502  63.639610  19.798990
33  16.970563  22.627417  76.367532  21.213203 199.404112   0.000000  83.438600
34  97.580736  91.923882  38.183766  93.338095  84.852814 114.551299  31.112698
35  14.142136  19.798990  73.539105  18.384776 196.575685   2.828427  80.610173
36  67.882251  62.225397   8.485281  63.639610 114.551299  84.852814   1.414214
37  14.142136   8.485281  45.254834   9.899495 168.291414  31.112698  52.325902
38 108.894444 103.237590  49.497475 104.651804  73.539105 125.865007  42.426407
39  14.142136  19.798990  73.539105  18.384776 196.575685   2.828427  80.610173
40   0.000000   5.656854  59.396970   4.242641 182.433550  16.970563  66.468037
41  77.781746  72.124892  18.384776  73.539105 104.651804  94.752309  11.313708
42  70.710678  65.053824  11.313708  66.468037 111.722871  87.681241   4.242641
43  15.556349  21.213203  74.953319  19.798990 197.989899   1.414214  82.024387
44   1.414214   4.242641  57.982756   2.828427 181.019336  18.384776  65.053824
45 195.161472 189.504617 135.764502 190.918831  12.727922 212.132034 128.693434
46   8.485281   2.828427  50.911688   4.242641 173.948268  25.455844  57.982756
47 142.835570 137.178716  83.438600 138.592929  39.597980 159.806133  76.367532
48  15.556349  21.213203  74.953319  19.798990 197.989899   1.414214  82.024387
49 135.764502 130.107648  76.367532 131.521861  46.669048 152.735065  69.296465
50 179.605122 173.948268 120.208153 175.362482   2.828427 196.575685 113.137085
51  52.325902  46.669048   7.071068  48.083261 130.107648  69.296465  14.142136
52  41.012193  35.355339  18.384776  36.769553 141.421356  57.982756  25.455844
53  16.970563  22.627417  76.367532  21.213203 199.404112   0.000000  83.438600
54  11.313708  16.970563  70.710678  15.556349 193.747258   5.656854  77.781746
55  16.970563  22.627417  76.367532  21.213203 199.404112   0.000000  83.438600
56   7.071068   1.414214  52.325902   2.828427 175.362482  24.041631  59.396970
57   9.899495  15.556349  69.296465  14.142136 192.333044   7.071068  76.367532
58 299.813275 294.156421 240.416306 295.570635 117.379726 316.783838 233.345238
59  11.313708  16.970563  70.710678  15.556349 193.747258   5.656854  77.781746
60  25.455844  19.798990  33.941125  21.213203 156.977705  42.426407  41.012193
61  14.142136  19.798990  73.539105  18.384776 196.575685   2.828427  80.610173
62   1.414214   4.242641  57.982756   2.828427 181.019336  18.384776  65.053824
63  48.083261  42.426407  11.313708  43.840620 134.350288  65.053824  18.384776
64 107.480231 101.823376  48.083261 103.237590  74.953319 124.450793  41.012193
65 275.771645 270.114790 216.374675 271.529004  93.338095 292.742207 209.303607
66   4.242641   1.414214  55.154329   0.000000 178.190909  21.213203  62.225397
67  16.970563  22.627417  76.367532  21.213203 199.404112   0.000000  83.438600
68  42.426407  36.769553  16.970563  38.183766 140.007143  59.396970  24.041631
69  90.509668  84.852814  31.112698  86.267027  91.923882 107.480231  24.041631
70  52.325902  46.669048   7.071068  48.083261 130.107648  69.296465  14.142136
71  12.727922  18.384776  72.124892  16.970563 195.161472   4.242641  79.195959
72 131.521861 125.865007  72.124892 127.279221  50.911688 148.492424  65.053824
73  12.727922   7.071068  46.669048   8.485281 169.705627  29.698485  53.740115
74   5.656854  11.313708  65.053824   9.899495 188.090404  11.313708  72.124892
75  16.970563  22.627417  76.367532  21.213203 199.404112   0.000000  83.438600
76   5.656854   0.000000  53.740115   1.414214 176.776695  22.627417  60.811183
77   7.071068  12.727922  66.468037  11.313708 189.504617   9.899495  73.539105
78   2.828427   2.828427  56.568542   1.414214 179.605122  19.798990  63.639610
79   2.828427   8.485281  62.225397   7.071068 185.261977  14.142136  69.296465
80 282.842712 277.185858 223.445743 278.600072 100.409163 299.813275 216.374675
            8          9         10         11         12         13         14
2                                                                              
3                                                                              
4                                                                              
5                                                                              
6                                                                              
7                                                                              
8                                                                              
9  141.421356                                                                  
10 193.747258  52.325902                                                       
11 188.090404  46.669048   5.656854                                            
12 202.232539  60.811183   8.485281  14.142136                                 
13 164.048773  22.627417  29.698485  24.041631  38.183766                      
14 147.078210   5.656854  46.669048  41.012193  55.154329  16.970563           
15  28.284271 169.705627 222.031529 216.374675 230.516811 192.333044 175.362482
16 154.149278  12.727922  39.597980  33.941125  48.083261   9.899495   7.071068
17  21.213203 162.634560 214.960461 209.303607 223.445743 185.261977 168.291414
18  76.367532  65.053824 117.379726 111.722871 125.865007  87.681241  70.710678
19 141.421356   0.000000  52.325902  46.669048  60.811183  22.627417   5.656854
20 183.847763  42.426407   9.899495   4.242641  18.384776  19.798990  36.769553
21 202.232539  60.811183   8.485281  14.142136   0.000000  38.183766  55.154329
22 193.747258  52.325902   0.000000   5.656854   8.485281  29.698485  46.669048
23 147.078210   5.656854  46.669048  41.012193  55.154329  16.970563   0.000000
24 192.333044  50.911688   1.414214   4.242641   9.899495  28.284271  45.254834
25 183.847763  42.426407   9.899495   4.242641  18.384776  19.798990  36.769553
26 199.404112  57.982756   5.656854  11.313708   2.828427  35.355339  52.325902
27 197.989899  56.568542   4.242641   9.899495   4.242641  33.941125  50.911688
28 173.948268  32.526912  19.798990  14.142136  28.284271   9.899495  26.870058
29 173.948268 315.369624 367.695526 362.038672 376.180808 337.997041 321.026479
30 190.918831  49.497475   2.828427   2.828427  11.313708  26.870058  43.840620
31 190.918831  49.497475   2.828427   2.828427  11.313708  26.870058  43.840620
32 138.592929   2.828427  55.154329  49.497475  63.639610  25.455844   8.485281
33 202.232539  60.811183   8.485281  14.142136   0.000000  38.183766  55.154329
34  87.681241  53.740115 106.066017 100.409163 114.551299  76.367532  59.396970
35 199.404112  57.982756   5.656854  11.313708   2.828427  35.355339  52.325902
36 117.379726  24.041631  76.367532  70.710678  84.852814  46.669048  29.698485
37 171.119841  29.698485  22.627417  16.970563  31.112698   7.071068  24.041631
38  76.367532  65.053824 117.379726 111.722871 125.865007  87.681241  70.710678
39 199.404112  57.982756   5.656854  11.313708   2.828427  35.355339  52.325902
40 185.261977  43.840620   8.485281   2.828427  16.970563  21.213203  38.183766
41 107.480231  33.941125  86.267027  80.610173  94.752309  56.568542  39.597980
42 114.551299  26.870058  79.195959  73.539105  87.681241  49.497475  32.526912
43 200.818326  59.396970   7.071068  12.727922   1.414214  36.769553  53.740115
44 183.847763  42.426407   9.899495   4.242641  18.384776  19.798990  36.769553
45   9.899495 151.320851 203.646753 197.989899 212.132034 173.948268 156.977705
46 176.776695  35.355339  16.970563  11.313708  25.455844  12.727922  29.698485
47  42.426407  98.994949 151.320851 145.663997 159.806133 121.622366 104.651804
48 200.818326  59.396970   7.071068  12.727922   1.414214  36.769553  53.740115
49  49.497475  91.923882 144.249783 138.592929 152.735065 114.551299  97.580736
50   5.656854 135.764502 188.090404 182.433550 196.575685 158.391919 141.421356
51 132.936075   8.485281  60.811183  55.154329  69.296465  31.112698  14.142136
52 144.249783   2.828427  49.497475  43.840620  57.982756  19.798990   2.828427
53 202.232539  60.811183   8.485281  14.142136   0.000000  38.183766  55.154329
54 196.575685  55.154329   2.828427   8.485281   5.656854  32.526912  49.497475
55 202.232539  60.811183   8.485281  14.142136   0.000000  38.183766  55.154329
56 178.190909  36.769553  15.556349   9.899495  24.041631  14.142136  31.112698
57 195.161472  53.740115   1.414214   7.071068   7.071068  31.112698  48.083261
58 114.551299 255.972655 308.298557 302.641702 316.783838 278.600072 261.629509
59 196.575685  55.154329   2.828427   8.485281   5.656854  32.526912  49.497475
60 159.806133  18.384776  33.941125  28.284271  42.426407   4.242641  12.727922
61 199.404112  57.982756   5.656854  11.313708   2.828427  35.355339  52.325902
62 183.847763  42.426407   9.899495   4.242641  18.384776  19.798990  36.769553
63 137.178716   4.242641  56.568542  50.911688  65.053824  26.870058   9.899495
64  77.781746  63.639610 115.965512 110.308658 124.450793  86.267027  69.296465
65  90.509668 231.931024 284.256926 278.600072 292.742207 254.558441 237.587878
66 181.019336  39.597980  12.727922   7.071068  21.213203  16.970563  33.941125
67 202.232539  60.811183   8.485281  14.142136   0.000000  38.183766  55.154329
68 142.835570   1.414214  50.911688  45.254834  59.396970  21.213203   4.242641
69  94.752309  46.669048  98.994949  93.338095 107.480231  69.296465  52.325902
70 132.936075   8.485281  60.811183  55.154329  69.296465  31.112698  14.142136
71 197.989899  56.568542   4.242641   9.899495   4.242641  33.941125  50.911688
72  53.740115  87.681241 140.007143 134.350288 148.492424 110.308658  93.338095
73 172.534055  31.112698  21.213203  15.556349  29.698485   8.485281  25.455844
74 190.918831  49.497475   2.828427   2.828427  11.313708  26.870058  43.840620
75 202.232539  60.811183   8.485281  14.142136   0.000000  38.183766  55.154329
76 179.605122  38.183766  14.142136   8.485281  22.627417  15.556349  32.526912
77 192.333044  50.911688   1.414214   4.242641   9.899495  28.284271  45.254834
78 182.433550  41.012193  11.313708   5.656854  19.798990  18.384776  35.355339
79 188.090404  46.669048   5.656854   0.000000  14.142136  24.041631  41.012193
80  97.580736 239.002092 291.327994 285.671140 299.813275 261.629509 244.658946
           15         16         17         18         19         20         21
2                                                                              
3                                                                              
4                                                                              
5                                                                              
6                                                                              
7                                                                              
8                                                                              
9                                                                              
10                                                                             
11                                                                             
12                                                                             
13                                                                             
14                                                                             
15                                                                             
16 182.433550                                                                  
17   7.071068 175.362482                                                       
18 104.651804  77.781746  97.580736                                            
19 169.705627  12.727922 162.634560  65.053824                                 
20 212.132034  29.698485 205.060967 107.480231  42.426407                      
21 230.516811  48.083261 223.445743 125.865007  60.811183  18.384776           
22 222.031529  39.597980 214.960461 117.379726  52.325902   9.899495   8.485281
23 175.362482   7.071068 168.291414  70.710678   5.656854  36.769553  55.154329
24 220.617316  38.183766 213.546248 115.965512  50.911688   8.485281   9.899495
25 212.132034  29.698485 205.060967 107.480231  42.426407   0.000000  18.384776
26 227.688384  45.254834 220.617316 123.036580  57.982756  15.556349   2.828427
27 226.274170  43.840620 219.203102 121.622366  56.568542  14.142136   4.242641
28 202.232539  19.798990 195.161472  97.580736  32.526912   9.899495  28.284271
29 145.663997 328.097546 152.735065 250.315801 315.369624 357.796031 376.180808
30 219.203102  36.769553 212.132034 114.551299  49.497475   7.071068  11.313708
31 219.203102  36.769553 212.132034 114.551299  49.497475   7.071068  11.313708
32 166.877200  15.556349 159.806133  62.225397   2.828427  45.254834  63.639610
33 230.516811  48.083261 223.445743 125.865007  60.811183  18.384776   0.000000
34 115.965512  66.468037 108.894444  11.313708  53.740115  96.166522 114.551299
35 227.688384  45.254834 220.617316 123.036580  57.982756  15.556349   2.828427
36 145.663997  36.769553 138.592929  41.012193  24.041631  66.468037  84.852814
37 199.404112  16.970563 192.333044  94.752309  29.698485  12.727922  31.112698
38 104.651804  77.781746  97.580736   0.000000  65.053824 107.480231 125.865007
39 227.688384  45.254834 220.617316 123.036580  57.982756  15.556349   2.828427
40 213.546248  31.112698 206.475180 108.894444  43.840620   1.414214  16.970563
41 135.764502  46.669048 128.693434  31.112698  33.941125  76.367532  94.752309
42 142.835570  39.597980 135.764502  38.183766  26.870058  69.296465  87.681241
43 229.102597  46.669048 222.031529 124.450793  59.396970  16.970563   1.414214
44 212.132034  29.698485 205.060967 107.480231  42.426407   0.000000  18.384776
45  18.384776 164.048773  11.313708  86.267027 151.320851 193.747258 212.132034
46 205.060967  22.627417 197.989899 100.409163  35.355339   7.071068  25.455844
47  70.710678 111.722871  63.639610  33.941125  98.994949 141.421356 159.806133
48 229.102597  46.669048 222.031529 124.450793  59.396970  16.970563   1.414214
49  77.781746 104.651804  70.710678  26.870058  91.923882 134.350288 152.735065
50  33.941125 148.492424  26.870058  70.710678 135.764502 178.190909 196.575685
51 161.220346  21.213203 154.149278  56.568542   8.485281  50.911688  69.296465
52 172.534055   9.899495 165.462987  67.882251   2.828427  39.597980  57.982756
53 230.516811  48.083261 223.445743 125.865007  60.811183  18.384776   0.000000
54 224.859956  42.426407 217.788889 120.208153  55.154329  12.727922   5.656854
55 230.516811  48.083261 223.445743 125.865007  60.811183  18.384776   0.000000
56 206.475180  24.041631 199.404112 101.823376  36.769553   5.656854  24.041631
57 223.445743  41.012193 216.374675 118.793939  53.740115  11.313708   7.071068
58  86.267027 268.700577  93.338095 190.918831 255.972655 298.399062 316.783838
59 224.859956  42.426407 217.788889 120.208153  55.154329  12.727922   5.656854
60 188.090404   5.656854 181.019336  83.438600  18.384776  24.041631  42.426407
61 227.688384  45.254834 220.617316 123.036580  57.982756  15.556349   2.828427
62 212.132034  29.698485 205.060967 107.480231  42.426407   0.000000  18.384776
63 165.462987  16.970563 158.391919  60.811183   4.242641  46.669048  65.053824
64 106.066017  76.367532  98.994949   1.414214  63.639610 106.066017 124.450793
65  62.225397 244.658946  69.296465 166.877200 231.931024 274.357431 292.742207
66 209.303607  26.870058 202.232539 104.651804  39.597980   2.828427  21.213203
67 230.516811  48.083261 223.445743 125.865007  60.811183  18.384776   0.000000
68 171.119841  11.313708 164.048773  66.468037   1.414214  41.012193  59.396970
69 123.036580  59.396970 115.965512  18.384776  46.669048  89.095454 107.480231
70 161.220346  21.213203 154.149278  56.568542   8.485281  50.911688  69.296465
71 226.274170  43.840620 219.203102 121.622366  56.568542  14.142136   4.242641
72  82.024387 100.409163  74.953319  22.627417  87.681241 130.107648 148.492424
73 200.818326  18.384776 193.747258  96.166522  31.112698  11.313708  29.698485
74 219.203102  36.769553 212.132034 114.551299  49.497475   7.071068  11.313708
75 230.516811  48.083261 223.445743 125.865007  60.811183  18.384776   0.000000
76 207.889394  25.455844 200.818326 103.237590  38.183766   4.242641  22.627417
77 220.617316  38.183766 213.546248 115.965512  50.911688   8.485281   9.899495
78 210.717821  28.284271 203.646753 106.066017  41.012193   1.414214  19.798990
79 216.374675  33.941125 209.303607 111.722871  46.669048   4.242641  14.142136
80  69.296465 251.730014  76.367532 173.948268 239.002092 281.428499 299.813275
           22         23         24         25         26         27         28
2                                                                              
3                                                                              
4                                                                              
5                                                                              
6                                                                              
7                                                                              
8                                                                              
9                                                                              
10                                                                             
11                                                                             
12                                                                             
13                                                                             
14                                                                             
15                                                                             
16                                                                             
17                                                                             
18                                                                             
19                                                                             
20                                                                             
21                                                                             
22                                                                             
23  46.669048                                                                  
24   1.414214  45.254834                                                       
25   9.899495  36.769553   8.485281                                            
26   5.656854  52.325902   7.071068  15.556349                                 
27   4.242641  50.911688   5.656854  14.142136   1.414214                      
28  19.798990  26.870058  18.384776   9.899495  25.455844  24.041631           
29 367.695526 321.026479 366.281313 357.796031 373.352380 371.938167 347.896536
30   2.828427  43.840620   1.414214   7.071068   8.485281   7.071068  16.970563
31   2.828427  43.840620   1.414214   7.071068   8.485281   7.071068  16.970563
32  55.154329   8.485281  53.740115  45.254834  60.811183  59.396970  35.355339
33   8.485281  55.154329   9.899495  18.384776   2.828427   4.242641  28.284271
34 106.066017  59.396970 104.651804  96.166522 111.722871 110.308658  86.267027
35   5.656854  52.325902   7.071068  15.556349   0.000000   1.414214  25.455844
36  76.367532  29.698485  74.953319  66.468037  82.024387  80.610173  56.568542
37  22.627417  24.041631  21.213203  12.727922  28.284271  26.870058   2.828427
38 117.379726  70.710678 115.965512 107.480231 123.036580 121.622366  97.580736
39   5.656854  52.325902   7.071068  15.556349   0.000000   1.414214  25.455844
40   8.485281  38.183766   7.071068   1.414214  14.142136  12.727922  11.313708
41  86.267027  39.597980  84.852814  76.367532  91.923882  90.509668  66.468037
42  79.195959  32.526912  77.781746  69.296465  84.852814  83.438600  59.396970
43   7.071068  53.740115   8.485281  16.970563   1.414214   2.828427  26.870058
44   9.899495  36.769553   8.485281   0.000000  15.556349  14.142136   9.899495
45 203.646753 156.977705 202.232539 193.747258 209.303607 207.889394 183.847763
46  16.970563  29.698485  15.556349   7.071068  22.627417  21.213203   2.828427
47 151.320851 104.651804 149.906638 141.421356 156.977705 155.563492 131.521861
48   7.071068  53.740115   8.485281  16.970563   1.414214   2.828427  26.870058
49 144.249783  97.580736 142.835570 134.350288 149.906638 148.492424 124.450793
50 188.090404 141.421356 186.676190 178.190909 193.747258 192.333044 168.291414
51  60.811183  14.142136  59.396970  50.911688  66.468037  65.053824  41.012193
52  49.497475   2.828427  48.083261  39.597980  55.154329  53.740115  29.698485
53   8.485281  55.154329   9.899495  18.384776   2.828427   4.242641  28.284271
54   2.828427  49.497475   4.242641  12.727922   2.828427   1.414214  22.627417
55   8.485281  55.154329   9.899495  18.384776   2.828427   4.242641  28.284271
56  15.556349  31.112698  14.142136   5.656854  21.213203  19.798990   4.242641
57   1.414214  48.083261   2.828427  11.313708   4.242641   2.828427  21.213203
58 308.298557 261.629509 306.884343 298.399062 313.955411 312.541197 288.499567
59   2.828427  49.497475   4.242641  12.727922   2.828427   1.414214  22.627417
60  33.941125  12.727922  32.526912  24.041631  39.597980  38.183766  14.142136
61   5.656854  52.325902   7.071068  15.556349   0.000000   1.414214  25.455844
62   9.899495  36.769553   8.485281   0.000000  15.556349  14.142136   9.899495
63  56.568542   9.899495  55.154329  46.669048  62.225397  60.811183  36.769553
64 115.965512  69.296465 114.551299 106.066017 121.622366 120.208153  96.166522
65 284.256926 237.587878 282.842712 274.357431 289.913780 288.499567 264.457936
66  12.727922  33.941125  11.313708   2.828427  18.384776  16.970563   7.071068
67   8.485281  55.154329   9.899495  18.384776   2.828427   4.242641  28.284271
68  50.911688   4.242641  49.497475  41.012193  56.568542  55.154329  31.112698
69  98.994949  52.325902  97.580736  89.095454 104.651804 103.237590  79.195959
70  60.811183  14.142136  59.396970  50.911688  66.468037  65.053824  41.012193
71   4.242641  50.911688   5.656854  14.142136   1.414214   0.000000  24.041631
72 140.007143  93.338095 138.592929 130.107648 145.663997 144.249783 120.208153
73  21.213203  25.455844  19.798990  11.313708  26.870058  25.455844   1.414214
74   2.828427  43.840620   1.414214   7.071068   8.485281   7.071068  16.970563
75   8.485281  55.154329   9.899495  18.384776   2.828427   4.242641  28.284271
76  14.142136  32.526912  12.727922   4.242641  19.798990  18.384776   5.656854
77   1.414214  45.254834   0.000000   8.485281   7.071068   5.656854  18.384776
78  11.313708  35.355339   9.899495   1.414214  16.970563  15.556349   8.485281
79   5.656854  41.012193   4.242641   4.242641  11.313708   9.899495  14.142136
80 291.327994 244.658946 289.913780 281.428499 296.984848 295.570635 271.529004
           29         30         31         32         33         34         35
2                                                                              
3                                                                              
4                                                                              
5                                                                              
6                                                                              
7                                                                              
8                                                                              
9                                                                              
10                                                                             
11                                                                             
12                                                                             
13                                                                             
14                                                                             
15                                                                             
16                                                                             
17                                                                             
18                                                                             
19                                                                             
20                                                                             
21                                                                             
22                                                                             
23                                                                             
24                                                                             
25                                                                             
26                                                                             
27                                                                             
28                                                                             
29                                                                             
30 364.867099                                                                  
31 364.867099   0.000000                                                       
32 312.541197  52.325902  52.325902                                            
33 376.180808  11.313708  11.313708  63.639610                                 
34 261.629509 103.237590 103.237590  50.911688 114.551299                      
35 373.352380   8.485281   8.485281  60.811183   2.828427 111.722871           
36 291.327994  73.539105  73.539105  21.213203  84.852814  29.698485  82.024387
37 345.068109  19.798990  19.798990  32.526912  31.112698  83.438600  28.284271
38 250.315801 114.551299 114.551299  62.225397 125.865007  11.313708 123.036580
39 373.352380   8.485281   8.485281  60.811183   2.828427 111.722871   0.000000
40 359.210245   5.656854   5.656854  46.669048  16.970563  97.580736  14.142136
41 281.428499  83.438600  83.438600  31.112698  94.752309  19.798990  91.923882
42 288.499567  76.367532  76.367532  24.041631  87.681241  26.870058  84.852814
43 374.766594   9.899495   9.899495  62.225397   1.414214 113.137085   1.414214
44 357.796031   7.071068   7.071068  45.254834  18.384776  96.166522  15.556349
45 164.048773 200.818326 200.818326 148.492424 212.132034  97.580736 209.303607
46 350.724963  14.142136  14.142136  38.183766  25.455844  89.095454  22.627417
47 216.374675 148.492424 148.492424  96.166522 159.806133  45.254834 156.977705
48 374.766594   9.899495   9.899495  62.225397   1.414214 113.137085   1.414214
49 223.445743 141.421356 141.421356  89.095454 152.735065  38.183766 149.906638
50 179.605122 185.261977 185.261977 132.936075 196.575685  82.024387 193.747258
51 306.884343  57.982756  57.982756   5.656854  69.296465  45.254834  66.468037
52 318.198052  46.669048  46.669048   5.656854  57.982756  56.568542  55.154329
53 376.180808  11.313708  11.313708  63.639610   0.000000 114.551299   2.828427
54 370.523953   5.656854   5.656854  57.982756   5.656854 108.894444   2.828427
55 376.180808  11.313708  11.313708  63.639610   0.000000 114.551299   2.828427
56 352.139177  12.727922  12.727922  39.597980  24.041631  90.509668  21.213203
57 369.109740   4.242641   4.242641  56.568542   7.071068 107.480231   4.242641
58  59.396970 305.470129 305.470129 253.144228 316.783838 202.232539 313.955411
59 370.523953   5.656854   5.656854  57.982756   5.656854 108.894444   2.828427
60 333.754401  31.112698  31.112698  21.213203  42.426407  72.124892  39.597980
61 373.352380   8.485281   8.485281  60.811183   2.828427 111.722871   0.000000
62 357.796031   7.071068   7.071068  45.254834  18.384776  96.166522  15.556349
63 311.126984  53.740115  53.740115   1.414214  65.053824  49.497475  62.225397
64 251.730014 113.137085 113.137085  60.811183 124.450793   9.899495 121.622366
65  83.438600 281.428499 281.428499 229.102597 292.742207 178.190909 289.913780
66 354.967604   9.899495   9.899495  42.426407  21.213203  93.338095  18.384776
67 376.180808  11.313708  11.313708  63.639610   0.000000 114.551299   2.828427
68 316.783838  48.083261  48.083261   4.242641  59.396970  55.154329  56.568542
69 268.700577  96.166522  96.166522  43.840620 107.480231   7.071068 104.651804
70 306.884343  57.982756  57.982756   5.656854  69.296465  45.254834  66.468037
71 371.938167   7.071068   7.071068  59.396970   4.242641 110.308658   1.414214
72 227.688384 137.178716 137.178716  84.852814 148.492424  33.941125 145.663997
73 346.482323  18.384776  18.384776  33.941125  29.698485  84.852814  26.870058
74 364.867099   0.000000   0.000000  52.325902  11.313708 103.237590   8.485281
75 376.180808  11.313708  11.313708  63.639610   0.000000 114.551299   2.828427
76 353.553391  11.313708  11.313708  41.012193  22.627417  91.923882  19.798990
77 366.281313   1.414214   1.414214  53.740115   9.899495 104.651804   7.071068
78 356.381818   8.485281   8.485281  43.840620  19.798990  94.752309  16.970563
79 362.038672   2.828427   2.828427  49.497475  14.142136 100.409163  11.313708
80  76.367532 288.499567 288.499567 236.173665 299.813275 185.261977 296.984848
           36         37         38         39         40         41         42
2                                                                              
3                                                                              
4                                                                              
5                                                                              
6                                                                              
7                                                                              
8                                                                              
9                                                                              
10                                                                             
11                                                                             
12                                                                             
13                                                                             
14                                                                             
15                                                                             
16                                                                             
17                                                                             
18                                                                             
19                                                                             
20                                                                             
21                                                                             
22                                                                             
23                                                                             
24                                                                             
25                                                                             
26                                                                             
27                                                                             
28                                                                             
29                                                                             
30                                                                             
31                                                                             
32                                                                             
33                                                                             
34                                                                             
35                                                                             
36                                                                             
37  53.740115                                                                  
38  41.012193  94.752309                                                       
39  82.024387  28.284271 123.036580                                            
40  67.882251  14.142136 108.894444  14.142136                                 
41   9.899495  63.639610  31.112698  91.923882  77.781746                      
42   2.828427  56.568542  38.183766  84.852814  70.710678   7.071068           
43  83.438600  29.698485 124.450793   1.414214  15.556349  93.338095  86.267027
44  66.468037  12.727922 107.480231  15.556349   1.414214  76.367532  69.296465
45 127.279221 181.019336  86.267027 209.303607 195.161472 117.379726 124.450793
46  59.396970   5.656854 100.409163  22.627417   8.485281  69.296465  62.225397
47  74.953319 128.693434  33.941125 156.977705 142.835570  65.053824  72.124892
48  83.438600  29.698485 124.450793   1.414214  15.556349  93.338095  86.267027
49  67.882251 121.622366  26.870058 149.906638 135.764502  57.982756  65.053824
50 111.722871 165.462987  70.710678 193.747258 179.605122 101.823376 108.894444
51  15.556349  38.183766  56.568542  66.468037  52.325902  25.455844  18.384776
52  26.870058  26.870058  67.882251  55.154329  41.012193  36.769553  29.698485
53  84.852814  31.112698 125.865007   2.828427  16.970563  94.752309  87.681241
54  79.195959  25.455844 120.208153   2.828427  11.313708  89.095454  82.024387
55  84.852814  31.112698 125.865007   2.828427  16.970563  94.752309  87.681241
56  60.811183   7.071068 101.823376  21.213203   7.071068  70.710678  63.639610
57  77.781746  24.041631 118.793939   4.242641   9.899495  87.681241  80.610173
58 231.931024 285.671140 190.918831 313.955411 299.813275 222.031529 229.102597
59  79.195959  25.455844 120.208153   2.828427  11.313708  89.095454  82.024387
60  42.426407  11.313708  83.438600  39.597980  25.455844  52.325902  45.254834
61  82.024387  28.284271 123.036580   0.000000  14.142136  91.923882  84.852814
62  66.468037  12.727922 107.480231  15.556349   1.414214  76.367532  69.296465
63  19.798990  33.941125  60.811183  62.225397  48.083261  29.698485  22.627417
64  39.597980  93.338095   1.414214 121.622366 107.480231  29.698485  36.769553
65 207.889394 261.629509 166.877200 289.913780 275.771645 197.989899 205.060967
66  63.639610   9.899495 104.651804  18.384776   4.242641  73.539105  66.468037
67  84.852814  31.112698 125.865007   2.828427  16.970563  94.752309  87.681241
68  25.455844  28.284271  66.468037  56.568542  42.426407  35.355339  28.284271
69  22.627417  76.367532  18.384776 104.651804  90.509668  12.727922  19.798990
70  15.556349  38.183766  56.568542  66.468037  52.325902  25.455844  18.384776
71  80.610173  26.870058 121.622366   1.414214  12.727922  90.509668  83.438600
72  63.639610 117.379726  22.627417 145.663997 131.521861  53.740115  60.811183
73  55.154329   1.414214  96.166522  26.870058  12.727922  65.053824  57.982756
74  73.539105  19.798990 114.551299   8.485281   5.656854  83.438600  76.367532
75  84.852814  31.112698 125.865007   2.828427  16.970563  94.752309  87.681241
76  62.225397   8.485281 103.237590  19.798990   5.656854  72.124892  65.053824
77  74.953319  21.213203 115.965512   7.071068   7.071068  84.852814  77.781746
78  65.053824  11.313708 106.066017  16.970563   2.828427  74.953319  67.882251
79  70.710678  16.970563 111.722871  11.313708   2.828427  80.610173  73.539105
80 214.960461 268.700577 173.948268 296.984848 282.842712 205.060967 212.132034
           43         44         45         46         47         48         49
2                                                                              
3                                                                              
4                                                                              
5                                                                              
6                                                                              
7                                                                              
8                                                                              
9                                                                              
10                                                                             
11                                                                             
12                                                                             
13                                                                             
14                                                                             
15                                                                             
16                                                                             
17                                                                             
18                                                                             
19                                                                             
20                                                                             
21                                                                             
22                                                                             
23                                                                             
24                                                                             
25                                                                             
26                                                                             
27                                                                             
28                                                                             
29                                                                             
30                                                                             
31                                                                             
32                                                                             
33                                                                             
34                                                                             
35                                                                             
36                                                                             
37                                                                             
38                                                                             
39                                                                             
40                                                                             
41                                                                             
42                                                                             
43                                                                             
44  16.970563                                                                  
45 210.717821 193.747258                                                       
46  24.041631   7.071068 186.676190                                            
47 158.391919 141.421356  52.325902 134.350288                                 
48   0.000000  16.970563 210.717821  24.041631 158.391919                      
49 151.320851 134.350288  59.396970 127.279221   7.071068 151.320851           
50 195.161472 178.190909  15.556349 171.119841  36.769553 195.161472  43.840620
51  67.882251  50.911688 142.835570  43.840620  90.509668  67.882251  83.438600
52  56.568542  39.597980 154.149278  32.526912 101.823376  56.568542  94.752309
53   1.414214  18.384776 212.132034  25.455844 159.806133   1.414214 152.735065
54   4.242641  12.727922 206.475180  19.798990 154.149278   4.242641 147.078210
55   1.414214  18.384776 212.132034  25.455844 159.806133   1.414214 152.735065
56  22.627417   5.656854 188.090404   1.414214 135.764502  22.627417 128.693434
57   5.656854  11.313708 205.060967  18.384776 152.735065   5.656854 145.663997
58 315.369624 298.399062 104.651804 291.327994 156.977705 315.369624 164.048773
59   4.242641  12.727922 206.475180  19.798990 154.149278   4.242641 147.078210
60  41.012193  24.041631 169.705627  16.970563 117.379726  41.012193 110.308658
61   1.414214  15.556349 209.303607  22.627417 156.977705   1.414214 149.906638
62  16.970563   0.000000 193.747258   7.071068 141.421356  16.970563 134.350288
63  63.639610  46.669048 147.078210  39.597980  94.752309  63.639610  87.681241
64 123.036580 106.066017  87.681241  98.994949  35.355339 123.036580  28.284271
65 291.327994 274.357431  80.610173 267.286363 132.936075 291.327994 140.007143
66  19.798990   2.828427 190.918831   4.242641 138.592929  19.798990 131.521861
67   1.414214  18.384776 212.132034  25.455844 159.806133   1.414214 152.735065
68  57.982756  41.012193 152.735065  33.941125 100.409163  57.982756  93.338095
69 106.066017  89.095454 104.651804  82.024387  52.325902 106.066017  45.254834
70  67.882251  50.911688 142.835570  43.840620  90.509668  67.882251  83.438600
71   2.828427  14.142136 207.889394  21.213203 155.563492   2.828427 148.492424
72 147.078210 130.107648  63.639610 123.036580  11.313708 147.078210   4.242641
73  28.284271  11.313708 182.433550   4.242641 130.107648  28.284271 123.036580
74   9.899495   7.071068 200.818326  14.142136 148.492424   9.899495 141.421356
75   1.414214  18.384776 212.132034  25.455844 159.806133   1.414214 152.735065
76  21.213203   4.242641 189.504617   2.828427 137.178716  21.213203 130.107648
77   8.485281   8.485281 202.232539  15.556349 149.906638   8.485281 142.835570
78  18.384776   1.414214 192.333044   5.656854 140.007143  18.384776 132.936075
79  12.727922   4.242641 197.989899  11.313708 145.663997  12.727922 138.592929
80 298.399062 281.428499  87.681241 274.357431 140.007143 298.399062 147.078210
           50         51         52         53         54         55         56
2                                                                              
3                                                                              
4                                                                              
5                                                                              
6                                                                              
7                                                                              
8                                                                              
9                                                                              
10                                                                             
11                                                                             
12                                                                             
13                                                                             
14                                                                             
15                                                                             
16                                                                             
17                                                                             
18                                                                             
19                                                                             
20                                                                             
21                                                                             
22                                                                             
23                                                                             
24                                                                             
25                                                                             
26                                                                             
27                                                                             
28                                                                             
29                                                                             
30                                                                             
31                                                                             
32                                                                             
33                                                                             
34                                                                             
35                                                                             
36                                                                             
37                                                                             
38                                                                             
39                                                                             
40                                                                             
41                                                                             
42                                                                             
43                                                                             
44                                                                             
45                                                                             
46                                                                             
47                                                                             
48                                                                             
49                                                                             
50                                                                             
51 127.279221                                                                  
52 138.592929  11.313708                                                       
53 196.575685  69.296465  57.982756                                            
54 190.918831  63.639610  52.325902   5.656854                                 
55 196.575685  69.296465  57.982756   0.000000   5.656854                      
56 172.534055  45.254834  33.941125  24.041631  18.384776  24.041631           
57 189.504617  62.225397  50.911688   7.071068   1.414214   7.071068  16.970563
58 120.208153 247.487373 258.801082 316.783838 311.126984 316.783838 292.742207
59 190.918831  63.639610  52.325902   5.656854   0.000000   5.656854  18.384776
60 154.149278  26.870058  15.556349  42.426407  36.769553  42.426407  18.384776
61 193.747258  66.468037  55.154329   2.828427   2.828427   2.828427  21.213203
62 178.190909  50.911688  39.597980  18.384776  12.727922  18.384776   5.656854
63 131.521861   4.242641   7.071068  65.053824  59.396970  65.053824  41.012193
64  72.124892  55.154329  66.468037 124.450793 118.793939 124.450793 100.409163
65  96.166522 223.445743 234.759451 292.742207 287.085353 292.742207 268.700577
66 175.362482  48.083261  36.769553  21.213203  15.556349  21.213203   2.828427
67 196.575685  69.296465  57.982756   0.000000   5.656854   0.000000  24.041631
68 137.178716   9.899495   1.414214  59.396970  53.740115  59.396970  35.355339
69  89.095454  38.183766  49.497475 107.480231 101.823376 107.480231  83.438600
70 127.279221   0.000000  11.313708  69.296465  63.639610  69.296465  45.254834
71 192.333044  65.053824  53.740115   4.242641   1.414214   4.242641  19.798990
72  48.083261  79.195959  90.509668 148.492424 142.835570 148.492424 124.450793
73 166.877200  39.597980  28.284271  29.698485  24.041631  29.698485   5.656854
74 185.261977  57.982756  46.669048  11.313708   5.656854  11.313708  12.727922
75 196.575685  69.296465  57.982756   0.000000   5.656854   0.000000  24.041631
76 173.948268  46.669048  35.355339  22.627417  16.970563  22.627417   1.414214
77 186.676190  59.396970  48.083261   9.899495   4.242641   9.899495  14.142136
78 176.776695  49.497475  38.183766  19.798990  14.142136  19.798990   4.242641
79 182.433550  55.154329  43.840620  14.142136   8.485281  14.142136   9.899495
80 103.237590 230.516811 241.830519 299.813275 294.156421 299.813275 275.771645
           57         58         59         60         61         62         63
2                                                                              
3                                                                              
4                                                                              
5                                                                              
6                                                                              
7                                                                              
8                                                                              
9                                                                              
10                                                                             
11                                                                             
12                                                                             
13                                                                             
14                                                                             
15                                                                             
16                                                                             
17                                                                             
18                                                                             
19                                                                             
20                                                                             
21                                                                             
22                                                                             
23                                                                             
24                                                                             
25                                                                             
26                                                                             
27                                                                             
28                                                                             
29                                                                             
30                                                                             
31                                                                             
32                                                                             
33                                                                             
34                                                                             
35                                                                             
36                                                                             
37                                                                             
38                                                                             
39                                                                             
40                                                                             
41                                                                             
42                                                                             
43                                                                             
44                                                                             
45                                                                             
46                                                                             
47                                                                             
48                                                                             
49                                                                             
50                                                                             
51                                                                             
52                                                                             
53                                                                             
54                                                                             
55                                                                             
56                                                                             
57                                                                             
58 309.712770                                                                  
59   1.414214 311.126984                                                       
60  35.355339 274.357431  36.769553                                            
61   4.242641 313.955411   2.828427  39.597980                                 
62  11.313708 298.399062  12.727922  24.041631  15.556349                      
63  57.982756 251.730014  59.396970  22.627417  62.225397  46.669048           
64 117.379726 192.333044 118.793939  82.024387 121.622366 106.066017  59.396970
65 285.671140  24.041631 287.085353 250.315801 289.913780 274.357431 227.688384
66  14.142136 295.570635  15.556349  21.213203  18.384776   2.828427  43.840620
67   7.071068 316.783838   5.656854  42.426407   2.828427  18.384776  65.053824
68  52.325902 257.386868  53.740115  16.970563  56.568542  41.012193   5.656854
69 100.409163 209.303607 101.823376  65.053824 104.651804  89.095454  42.426407
70  62.225397 247.487373  63.639610  26.870058  66.468037  50.911688   4.242641
71   2.828427 312.541197   1.414214  38.183766   1.414214  14.142136  60.811183
72 141.421356 168.291414 142.835570 106.066017 145.663997 130.107648  83.438600
73  22.627417 287.085353  24.041631  12.727922  26.870058  11.313708  35.355339
74   4.242641 305.470129   5.656854  31.112698   8.485281   7.071068  53.740115
75   7.071068 316.783838   5.656854  42.426407   2.828427  18.384776  65.053824
76  15.556349 294.156421  16.970563  19.798990  19.798990   4.242641  42.426407
77   2.828427 306.884343   4.242641  32.526912   7.071068   8.485281  55.154329
78  12.727922 296.984848  14.142136  22.627417  16.970563   1.414214  45.254834
79   7.071068 302.641702   8.485281  28.284271  11.313708   4.242641  50.911688
80 292.742207  16.970563 294.156421 257.386868 296.984848 281.428499 234.759451
           64         65         66         67         68         69         70
2                                                                              
3                                                                              
4                                                                              
5                                                                              
6                                                                              
7                                                                              
8                                                                              
9                                                                              
10                                                                             
11                                                                             
12                                                                             
13                                                                             
14                                                                             
15                                                                             
16                                                                             
17                                                                             
18                                                                             
19                                                                             
20                                                                             
21                                                                             
22                                                                             
23                                                                             
24                                                                             
25                                                                             
26                                                                             
27                                                                             
28                                                                             
29                                                                             
30                                                                             
31                                                                             
32                                                                             
33                                                                             
34                                                                             
35                                                                             
36                                                                             
37                                                                             
38                                                                             
39                                                                             
40                                                                             
41                                                                             
42                                                                             
43                                                                             
44                                                                             
45                                                                             
46                                                                             
47                                                                             
48                                                                             
49                                                                             
50                                                                             
51                                                                             
52                                                                             
53                                                                             
54                                                                             
55                                                                             
56                                                                             
57                                                                             
58                                                                             
59                                                                             
60                                                                             
61                                                                             
62                                                                             
63                                                                             
64                                                                             
65 168.291414                                                                  
66 103.237590 271.529004                                                       
67 124.450793 292.742207  21.213203                                            
68  65.053824 233.345238  38.183766  59.396970                                 
69  16.970563 185.261977  86.267027 107.480231  48.083261                      
70  55.154329 223.445743  48.083261  69.296465   9.899495  38.183766           
71 120.208153 288.499567  16.970563   4.242641  55.154329 103.237590  65.053824
72  24.041631 144.249783 127.279221 148.492424  89.095454  41.012193  79.195959
73  94.752309 263.043723   8.485281  29.698485  29.698485  77.781746  39.597980
74 113.137085 281.428499   9.899495  11.313708  48.083261  96.166522  57.982756
75 124.450793 292.742207  21.213203   0.000000  59.396970 107.480231  69.296465
76 101.823376 270.114790   1.414214  22.627417  36.769553  84.852814  46.669048
77 114.551299 282.842712  11.313708   9.899495  49.497475  97.580736  59.396970
78 104.651804 272.943218   1.414214  19.798990  39.597980  87.681241  49.497475
79 110.308658 278.600072   7.071068  14.142136  45.254834  93.338095  55.154329
80 175.362482   7.071068 278.600072 299.813275 240.416306 192.333044 230.516811
           71         72         73         74         75         76         77
2                                                                              
3                                                                              
4                                                                              
5                                                                              
6                                                                              
7                                                                              
8                                                                              
9                                                                              
10                                                                             
11                                                                             
12                                                                             
13                                                                             
14                                                                             
15                                                                             
16                                                                             
17                                                                             
18                                                                             
19                                                                             
20                                                                             
21                                                                             
22                                                                             
23                                                                             
24                                                                             
25                                                                             
26                                                                             
27                                                                             
28                                                                             
29                                                                             
30                                                                             
31                                                                             
32                                                                             
33                                                                             
34                                                                             
35                                                                             
36                                                                             
37                                                                             
38                                                                             
39                                                                             
40                                                                             
41                                                                             
42                                                                             
43                                                                             
44                                                                             
45                                                                             
46                                                                             
47                                                                             
48                                                                             
49                                                                             
50                                                                             
51                                                                             
52                                                                             
53                                                                             
54                                                                             
55                                                                             
56                                                                             
57                                                                             
58                                                                             
59                                                                             
60                                                                             
61                                                                             
62                                                                             
63                                                                             
64                                                                             
65                                                                             
66                                                                             
67                                                                             
68                                                                             
69                                                                             
70                                                                             
71                                                                             
72 144.249783                                                                  
73  25.455844 118.793939                                                       
74   7.071068 137.178716  18.384776                                            
75   4.242641 148.492424  29.698485  11.313708                                 
76  18.384776 125.865007   7.071068  11.313708  22.627417                      
77   5.656854 138.592929  19.798990   1.414214   9.899495  12.727922           
78  15.556349 128.693434   9.899495   8.485281  19.798990   2.828427   9.899495
79   9.899495 134.350288  15.556349   2.828427  14.142136   8.485281   4.242641
80 295.570635 151.320851 270.114790 288.499567 299.813275 277.185858 289.913780
           78         79
2                       
3                       
4                       
5                       
6                       
7                       
8                       
9                       
10                      
11                      
12                      
13                      
14                      
15                      
16                      
17                      
18                      
19                      
20                      
21                      
22                      
23                      
24                      
25                      
26                      
27                      
28                      
29                      
30                      
31                      
32                      
33                      
34                      
35                      
36                      
37                      
38                      
39                      
40                      
41                      
42                      
43                      
44                      
45                      
46                      
47                      
48                      
49                      
50                      
51                      
52                      
53                      
54                      
55                      
56                      
57                      
58                      
59                      
60                      
61                      
62                      
63                      
64                      
65                      
66                      
67                      
68                      
69                      
70                      
71                      
72                      
73                      
74                      
75                      
76                      
77                      
78                      
79   5.656854           
80 280.014285 285.671140

A short note about ClustGeo package

ClustGeo package is an R package specially designed to support the need of performing spatially constrained cluster analysis. More specifically, it provides a Ward-like hierarchical clustering algorithm called hclustgeo() including spatial/geographical constraints.

In a nutshell, the algorithm uses two dissimilarity matrices D0 and D1 along with a mixing parameter alpha, whereby the value of alpha must be a real number between [0, 1]. D0 can be non-Euclidean and the weights of the observations can be non-uniform. It gives the dissimilarities in the attribute/clustering variable space. D1, on the other hand, gives the dissimilarities in the constraint space. The criterion minimised at each stage is a convex combination of the homogeneity criterion calculated with D0 and the homogeneity criterion calculated with D1.

The idea is then to determine a value of alpha which increases the spatial contiguity without deteriorating too much the quality of the solution based on the variables of interest. This need is supported by a function called choicealpha().

Ward-like hierarchical clustering: ClustGeo

ClustGeo package provides function called hclustgeo() to perform a typical Ward-like hierarchical clustering just like hclust() you learned in previous section.

To perform non-spatially constrained hierarchical clustering, we only need to provide the function a dissimilarity matrix as shown in the code chunk below.

nongeo_cluster <- hclustgeo(proxmat)
plot(nongeo_cluster, cex = 0.5)
rect.hclust(nongeo_cluster, 
            k = 6, 
            border = 2:5)

class(nongeo_cluster)
[1] "hclust"

Mapping the clusters formed

groups <- as.factor(cutree(nongeo_cluster, k=6))
myanmar_ngeo_cluster <- cbind(mmr_shp_mimu_2, as.matrix(groups)) %>%
  rename(`CLUSTER` = `as.matrix.groups.`)
qtm(myanmar_ngeo_cluster, "CLUSTER")

Spatially Constrained Hierarchical Clustering

Before we can perform spatially constrained hierarchical clustering, a spatial distance matrix will be derived by using st_distance() of sf package.

dist <- st_distance(mmr_shp_mimu_2, mmr_shp_mimu_2)
distmat <- as.dist(dist)

Notice that as.dist() is used to convert the data frame into matrix.

Next, choicealpha() will be used to determine a suitable value for the mixing parameter alpha as shown in the code chunk below.

cr <- choicealpha(proxmat, distmat, range.alpha = seq(0, 1, 0.1), K=6, graph = TRUE)

With reference to the graphs above, alpha = 0.6 will be used as shown in the code chunk below.

clustG <- hclustgeo(proxmat, distmat, alpha = 0.6)

Next, cutree() is used to derive the cluster object.

groups <- as.factor(cutree(clustG, k=6))

We will then join back the group list with mmr_shp_mimu polygon feature data frame by using the code chunk below.

MMR_sf_Gcluster <- cbind(mmr_shp_mimu_2, as.matrix(groups)) %>%
  rename(`CLUSTER` = `as.matrix.groups.`)

We can now plot the map of the newly delineated spatially constrained clusters.

qtm(MMR_sf_Gcluster, "CLUSTER")

Visual Interpretation of Clusters

Visualising individual clustering variable

Code chunk below is used to reveal the distribution of a clustering variable (i.e Battles_2022_Incidents) by cluster.

#ggplot(data = myanmar_ngeo_cluster,
#       aes(x = CLUSTER, y = Battles_2022_Incidents)) +
#  geom_boxplot()

References

Main reference: Kam, T.S. (2024). Geographical Segmentation with Spatially Constrained Clustering Techniques

Back to top