I'm looking to see if I can cluster geographic regions by a variable, such as losses.
For example, I have 5 regions with the following amount of losses: Region 1 with \$500,000 in losses. Region 2 with \$400,000 in losses. Region 3 with \$200,000 in losses. Region 4 with \$200,000 in losses. Region 5 with \$300,000 in losses.
Ideally I'd like to cluster them based on similar losses (for example, clustering region 3 and 4 together since they share the same amount of total losses). However, I need to ensure that the regions are spatially adjacent to each other. So if region 3 is not right next to region 4, I would not allow them to be clustered together.
I have a shapefile of all the regions, which includes the centroid latitude and longitude of each region.
My idea for doing this is taking a distance matrix (derived by the latitude and longitude coordinates) and combining it with another distance matrix (derived from losses). Would this sort of approach work?If so, what would the R code look like for this sort of merge?
If not, what sort of approach would be recommended?