IS415 Geospatial Analytics and Application

Instructor: Dr. Kam Tin Seong.

Assoc. Professor of Information Systems (Practice)

Delineating Industry Clusters by using Geographic Segmentation Approach

1. Overview

Task:

  • Preparing a series of choropleth maps showing the distribution of spatial specialisation by industry type, 2016 at municipality level.

  • Delineating industry specialisation clusters by using hierarchical clustering method and display their distribution by using appropriate thematic mapping technique.

  • Delineating industry specialisation clusters by using spatially constrained clustering method and display their distribution by using appropriate thematic mapping technique.

1.1. Data sets used

  • 2016 Brazil Municipality boundary file and metropolitan boundary file. This is extracted using the geobr package

  • “BRAZIL_CITIES.csv” - This data file consists of 81 columns and 5573 rows. Each row representing one municipality.

  • “Data_Dictionary.csv” - This file provides meta data of each columns in BRAZIL_CITIES.csv.

Both BRAZIL_CITIES.csv and Data_Dictionary.csv can be downloaded from Kaggle.

1.2. Install & Load R packages

R packages used:

  • tidyverse - for reading, handling and visualizing attribute data (readr, ggplot2 & dplyr)

  • tmap - for choropleth mapping

  • sf, rgdal, raster - for handling spatial data

  • spdep - for spatial statistical analysis

  • geobr - access to official spatial data sets of Brazil as ‘sf’ objects in R

  • corrplot, ggpubr, heatmaply - multivariate data visualization and analysis

  • cluster - clustering analysis

packages = c('tidyverse', 'tmap','rgdal', 'spdep','raster', 'geobr', 'sf', 'ggpubr', 'cluster', 'factoextra', 'heatmaply', 'corrplot', 'psych')
for (p in packages){
  if(!require(p, character.only = T)){
    install.packages(p)
  }
  library(p, character.only = T)
}

2. Geospatial data wrangling

2.1 Importing geospatial data

We want to segment São Paulo Macrometropolis at the municipality level by using data provided by Brazilian Institute of Geography and Statistics,IBGE.

We will first find out the available datasets/functions in the geobr package using list_geobr() function.

datasets <- list_geobr()
datasets
## # A tibble: 23 x 4
##    `function`       geography             years                           source
##    <chr>            <chr>                 <chr>                           <chr> 
##  1 `read_country`   Country               1872, 1900, 1911, 1920, 1933, ~ IBGE  
##  2 `read_region`    Region                2000, 2001, 2010, 2013, 2014, ~ IBGE  
##  3 `read_state`     States                1872, 1900, 1911, 1920, 1933, ~ IBGE  
##  4 `read_meso_regi~ Meso region           2000, 2001, 2010, 2013, 2014, ~ IBGE  
##  5 `read_micro_reg~ Micro region          2000, 2001, 2010, 2013, 2014, ~ IBGE  
##  6 `read_intermedi~ Intermediate region   2017, 2019                      IBGE  
##  7 `read_immediate~ Immediate region      2017, 2019                      IBGE  
##  8 `read_weighting~ Census weighting are~ 2010                            IBGE  
##  9 `read_census_tr~ Census tract (setor ~ 2000, 2010                      IBGE  
## 10 `read_municipal~ Municipality seats (~ 1872, 1900, 1911, 1920, 1933, ~ IBGE  
## # ... with 13 more rows

From my research, some findings are:

  • State - subnational entities with certain degree of autonomy, there are 26 states in Brazil

  • Municipality - states are divided into municipalities, there are 5,570 municipalities in Brazil, the average state in Brazil has 214 municipalities

  • São Paulo has 645 municipalities, grouped into 63 microregions, furthe grouped into 15 mesoregions.

  • Meso - meso region was a subdivision of the Brazilian states, grouping together various municipalities in proximity and with common characteristics. They were abolished in 2017 and replaced by “intermediary geographic regions”

  • Micro - micro region was a legally defined area consisting of a group of municipalities. They were abolished in 2017 and replaced by “immediate geographic regions”

Microregions and mesoregions were used primarily for statistical purposes by the IBGE.

Since we want to get the municipalities of São Paulo state as well as the metropolitan areas, we will use read_municipality() function and read_metro_area() function of geobr package.

municipality <- read_municipality(code_muni =  "all", year = 2016)
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |========                                                              |  11%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |================                                                      |  22%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |======================================================                |  78%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |======================================================================| 100%
metro_area <- read_metro_area(year = 2016)
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
## 
Downloading: 770 B     
Downloading: 770 B     
Downloading: 1.2 kB     
Downloading: 1.2 kB     
Downloading: 2.1 kB     
Downloading: 2.1 kB     
Downloading: 2.1 kB     
Downloading: 2.1 kB     
Downloading: 2.1 kB     
Downloading: 2.1 kB     
Downloading: 10 kB     
Downloading: 10 kB     
Downloading: 10 kB     
Downloading: 10 kB     
Downloading: 10 kB     
Downloading: 10 kB     
Downloading: 10 kB     
Downloading: 10 kB     
Downloading: 10 kB     
Downloading: 10 kB     
Downloading: 18 kB     
Downloading: 18 kB     
Downloading: 18 kB     
Downloading: 18 kB     
Downloading: 18 kB     
Downloading: 18 kB     
Downloading: 26 kB     
Downloading: 26 kB     
Downloading: 26 kB     
Downloading: 26 kB     
Downloading: 26 kB     
Downloading: 26 kB     
Downloading: 34 kB     
Downloading: 34 kB     
Downloading: 51 kB     
Downloading: 51 kB     
Downloading: 67 kB     
Downloading: 67 kB     
Downloading: 83 kB     
Downloading: 83 kB     
Downloading: 83 kB     
Downloading: 83 kB     
Downloading: 91 kB     
Downloading: 91 kB     
Downloading: 91 kB     
Downloading: 91 kB     
Downloading: 91 kB     
Downloading: 91 kB     
Downloading: 91 kB     
Downloading: 91 kB     
Downloading: 99 kB     
Downloading: 99 kB     
Downloading: 99 kB     
Downloading: 99 kB     
Downloading: 110 kB     
Downloading: 110 kB     
Downloading: 110 kB     
Downloading: 110 kB     
Downloading: 110 kB     
Downloading: 110 kB     
Downloading: 120 kB     
Downloading: 120 kB     
Downloading: 120 kB     
Downloading: 120 kB     
Downloading: 120 kB     
Downloading: 120 kB     
Downloading: 120 kB     
Downloading: 120 kB     
Downloading: 130 kB     
Downloading: 130 kB     
Downloading: 130 kB     
Downloading: 130 kB     
Downloading: 140 kB     
Downloading: 140 kB     
Downloading: 140 kB     
Downloading: 140 kB     
Downloading: 150 kB     
Downloading: 150 kB     
Downloading: 150 kB     
Downloading: 150 kB     
Downloading: 150 kB     
Downloading: 150 kB     
Downloading: 150 kB     
Downloading: 150 kB     
Downloading: 150 kB     
Downloading: 150 kB     
Downloading: 160 kB     
Downloading: 160 kB     
Downloading: 160 kB     
Downloading: 160 kB     
Downloading: 160 kB     
Downloading: 160 kB     
Downloading: 160 kB     
Downloading: 160 kB     
Downloading: 160 kB     
Downloading: 160 kB     
Downloading: 170 kB     
Downloading: 170 kB     
Downloading: 170 kB     
Downloading: 170 kB     
Downloading: 180 kB     
Downloading: 180 kB     
Downloading: 180 kB     
Downloading: 180 kB     
Downloading: 190 kB     
Downloading: 190 kB     
Downloading: 200 kB     
Downloading: 200 kB     
Downloading: 200 kB     
Downloading: 200 kB     
Downloading: 200 kB     
Downloading: 200 kB     
Downloading: 200 kB     
Downloading: 200 kB     
Downloading: 200 kB     
Downloading: 200 kB     
Downloading: 210 kB     
Downloading: 210 kB     
Downloading: 210 kB     
Downloading: 210 kB     
Downloading: 220 kB     
Downloading: 220 kB     
Downloading: 220 kB     
Downloading: 220 kB     
Downloading: 230 kB     
Downloading: 230 kB     
Downloading: 230 kB     
Downloading: 230 kB     
Downloading: 230 kB     
Downloading: 230 kB     
Downloading: 240 kB     
Downloading: 240 kB     
Downloading: 240 kB     
Downloading: 240 kB     
Downloading: 240 kB     
Downloading: 240 kB     
Downloading: 240 kB     
Downloading: 240 kB     
Downloading: 240 kB     
Downloading: 240 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 250 kB     
Downloading: 260 kB     
Downloading: 260 kB     
Downloading: 260 kB     
Downloading: 260 kB     
Downloading: 270 kB     
Downloading: 270 kB     
Downloading: 280 kB     
Downloading: 280 kB     
Downloading: 280 kB     
Downloading: 280 kB     
Downloading: 280 kB     
Downloading: 280 kB     
Downloading: 280 kB     
Downloading: 280 kB     
Downloading: 280 kB     
Downloading: 280 kB     
Downloading: 290 kB     
Downloading: 290 kB     
Downloading: 290 kB     
Downloading: 290 kB     
Downloading: 290 kB     
Downloading: 290 kB     
Downloading: 290 kB     
Downloading: 290 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 300 kB     
Downloading: 310 kB     
Downloading: 310 kB     
Downloading: 310 kB     
Downloading: 310 kB     
Downloading: 320 kB     
Downloading: 320 kB     
Downloading: 320 kB     
Downloading: 320 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 330 kB     
Downloading: 340 kB     
Downloading: 340 kB     
Downloading: 340 kB     
Downloading: 340 kB     
Downloading: 350 kB     
Downloading: 350 kB     
Downloading: 360 kB     
Downloading: 360 kB     
Downloading: 360 kB     
Downloading: 360 kB     
Downloading: 360 kB     
Downloading: 360 kB     
Downloading: 370 kB     
Downloading: 370 kB     
Downloading: 370 kB     
Downloading: 370 kB     
Downloading: 370 kB     
Downloading: 370 kB     
Downloading: 380 kB     
Downloading: 380 kB     
Downloading: 390 kB     
Downloading: 390 kB     
Downloading: 390 kB     
Downloading: 390 kB     
Downloading: 400 kB     
Downloading: 400 kB     
Downloading: 400 kB     
Downloading: 400 kB     
Downloading: 410 kB     
Downloading: 410 kB     
Downloading: 410 kB     
Downloading: 410 kB     
Downloading: 410 kB     
Downloading: 410 kB     
Downloading: 420 kB     
Downloading: 420 kB     
Downloading: 420 kB     
Downloading: 420 kB     
Downloading: 420 kB     
Downloading: 420 kB     
Downloading: 420 kB     
Downloading: 420 kB     
Downloading: 420 kB     
Downloading: 420 kB     
Downloading: 430 kB     
Downloading: 430 kB     
Downloading: 430 kB     
Downloading: 430 kB     
Downloading: 440 kB     
Downloading: 440 kB     
Downloading: 440 kB     
Downloading: 440 kB     
Downloading: 440 kB     
Downloading: 440 kB     
Downloading: 450 kB     
Downloading: 450 kB     
Downloading: 450 kB     
Downloading: 450 kB     
Downloading: 450 kB     
Downloading: 450 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 460 kB     
Downloading: 470 kB     
Downloading: 470 kB     
Downloading: 470 kB     
Downloading: 470 kB     
Downloading: 470 kB     
Downloading: 470 kB     
Downloading: 490 kB     
Downloading: 490 kB     
Downloading: 490 kB     
Downloading: 490 kB     
Downloading: 490 kB     
Downloading: 490 kB     
Downloading: 500 kB     
Downloading: 500 kB     
Downloading: 500 kB     
Downloading: 500 kB     
Downloading: 500 kB     
Downloading: 500 kB     
Downloading: 500 kB     
Downloading: 500 kB     
Downloading: 500 kB     
Downloading: 500 kB     
Downloading: 510 kB     
Downloading: 510 kB     
Downloading: 510 kB     
Downloading: 510 kB     
Downloading: 510 kB     
Downloading: 510 kB     
Downloading: 530 kB     
Downloading: 530 kB     
Downloading: 540 kB     
Downloading: 540 kB     
Downloading: 560 kB     
Downloading: 560 kB     
Downloading: 560 kB     
Downloading: 560 kB     
Downloading: 570 kB     
Downloading: 570 kB     
Downloading: 570 kB     
Downloading: 570 kB     
Downloading: 580 kB     
Downloading: 580 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 590 kB     
Downloading: 600 kB     
Downloading: 600 kB     
Downloading: 600 kB     
Downloading: 600 kB     
Downloading: 600 kB     
Downloading: 600 kB     
Downloading: 600 kB     
Downloading: 600 kB     
Downloading: 610 kB     
Downloading: 610 kB     
Downloading: 610 kB     
Downloading: 610 kB     
Downloading: 610 kB     
Downloading: 610 kB     
Downloading: 610 kB     
Downloading: 610 kB     
Downloading: 620 kB     
Downloading: 620 kB     
Downloading: 620 kB     
Downloading: 620 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 630 kB     
Downloading: 640 kB     
Downloading: 640 kB     
Downloading: 640 kB     
Downloading: 640 kB     
Downloading: 640 kB     
Downloading: 640 kB     
Downloading: 650 kB     
Downloading: 650 kB     
Downloading: 650 kB     
Downloading: 650 kB     
Downloading: 650 kB     
Downloading: 650 kB     
Downloading: 660 kB     
Downloading: 660 kB     
Downloading: 670 kB     
Downloading: 670 kB     
Downloading: 670 kB     
Downloading: 670 kB     
Downloading: 670 kB     
Downloading: 670 kB     
Downloading: 670 kB     
Downloading: 670 kB     
Downloading: 680 kB     
Downloading: 680 kB     
Downloading: 680 kB     
Downloading: 680 kB     
Downloading: 680 kB     
Downloading: 680 kB     
Downloading: 690 kB     
Downloading: 690 kB     
Downloading: 690 kB     
Downloading: 690 kB     
Downloading: 690 kB     
Downloading: 690 kB     
Downloading: 700 kB     
Downloading: 700 kB     
Downloading: 710 kB     
Downloading: 710 kB     
Downloading: 710 kB     
Downloading: 710 kB     
Downloading: 710 kB     
Downloading: 710 kB     
Downloading: 710 kB     
Downloading: 710 kB     
Downloading: 720 kB     
Downloading: 720 kB     
Downloading: 720 kB     
Downloading: 720 kB     
Downloading: 730 kB     
Downloading: 730 kB     
Downloading: 730 kB     
Downloading: 730 kB     
Downloading: 730 kB     
Downloading: 730 kB     
Downloading: 740 kB     
Downloading: 740 kB     
Downloading: 740 kB     
Downloading: 740 kB     
Downloading: 750 kB     
Downloading: 750 kB     
Downloading: 750 kB     
Downloading: 750 kB     
Downloading: 760 kB     
Downloading: 760 kB     
Downloading: 760 kB     
Downloading: 760 kB     
Downloading: 760 kB     
Downloading: 760 kB     
Downloading: 760 kB     
Downloading: 760 kB     
Downloading: 770 kB     
Downloading: 770 kB     
Downloading: 770 kB     
Downloading: 770 kB     
Downloading: 770 kB     
Downloading: 770 kB     
Downloading: 780 kB     
Downloading: 780 kB     
Downloading: 780 kB     
Downloading: 780 kB     
Downloading: 780 kB     
Downloading: 780 kB     
Downloading: 790 kB     
Downloading: 790 kB     
Downloading: 790 kB     
Downloading: 790 kB     
Downloading: 790 kB     
Downloading: 790 kB     
Downloading: 790 kB     
Downloading: 790 kB     
Downloading: 800 kB     
Downloading: 800 kB     
Downloading: 800 kB     
Downloading: 800 kB     
Downloading: 800 kB     
Downloading: 800 kB     
Downloading: 800 kB     
Downloading: 800 kB     
Downloading: 800 kB     
Downloading: 800 kB     
Downloading: 810 kB     
Downloading: 810 kB     
Downloading: 810 kB     
Downloading: 810 kB     
Downloading: 820 kB     
Downloading: 820 kB     
Downloading: 820 kB     
Downloading: 820 kB     
Downloading: 820 kB     
Downloading: 820 kB     
Downloading: 840 kB     
Downloading: 840 kB     
Downloading: 850 kB     
Downloading: 850 kB     
Downloading: 870 kB     
Downloading: 870 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 880 kB     
Downloading: 890 kB     
Downloading: 890 kB     
Downloading: 890 kB     
Downloading: 890 kB     
Downloading: 890 kB     
Downloading: 890 kB     
Downloading: 890 kB     
Downloading: 890 kB     
Downloading: 900 kB     
Downloading: 900 kB     
Downloading: 900 kB     
Downloading: 900 kB     
Downloading: 900 kB     
Downloading: 900 kB     
Downloading: 900 kB     
Downloading: 900 kB     
Downloading: 900 kB     
Downloading: 900 kB     
Downloading: 910 kB     
Downloading: 910 kB     
Downloading: 910 kB     
Downloading: 910 kB     
Downloading: 910 kB     
Downloading: 910 kB     
Downloading: 910 kB     
Downloading: 910 kB     
Downloading: 920 kB     
Downloading: 920 kB     
Downloading: 920 kB     
Downloading: 920 kB     
Downloading: 920 kB     
Downloading: 920 kB     
Downloading: 920 kB     
Downloading: 920 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 930 kB     
Downloading: 940 kB     
Downloading: 940 kB     
Downloading: 940 kB     
Downloading: 940 kB     
Downloading: 940 kB     
Downloading: 940 kB     
Downloading: 940 kB     
Downloading: 940 kB     
Downloading: 950 kB     
Downloading: 950 kB     
Downloading: 950 kB     
Downloading: 950 kB     
Downloading: 950 kB     
Downloading: 950 kB     
Downloading: 960 kB     
Downloading: 960 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 970 kB     
Downloading: 980 kB     
Downloading: 980 kB     
Downloading: 980 kB     
Downloading: 980 kB     
Downloading: 990 kB     
Downloading: 990 kB     
Downloading: 990 kB     
Downloading: 990 kB     
Downloading: 990 kB     
Downloading: 990 kB     
Downloading: 990 kB     
Downloading: 990 kB     
Downloading: 1,000 kB     
Downloading: 1,000 kB     
Downloading: 1,000 kB     
Downloading: 1,000 kB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.1 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.2 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.3 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.4 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.5 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.6 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.7 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.8 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 1.9 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.1 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.2 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.3 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.4 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.5 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.6 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.7 MB     
Downloading: 2.8 MB     
Downloading: 2.8 MB     
Downloading: 2.8 MB     
Downloading: 2.8 MB     
Downloading: 2.8 MB     
Downloading: 2.8 MB

São Paulo Macrometropolis is one of the biggest urban agglomerations in the world.

Beyond the Greater São Paulo, the megalopolis encompasses the metropolitan areas of Campinas, Santos, Sorocaba and the Paraíba Valley, and other nearby cities, which include urban agglomerations in the conurbation process, as Jundiaí and Piracicaba.

Hence, we will extract the metro area of the Sao Paulo state.

metro_area_saopaulo <- metro_area %>%
  filter(abbrev_state == "SP")
distinct(as.data.frame(metro_area_saopaulo$name_metro))
##                    metro_area_saopaulo$name_metro
## 1                   Aglomeração Urbana de Jundiaí
## 2 Aglomeração Urbana de Piracicaba-AU- Piracicaba
## 3                             RM Baixada Santista
## 4                                     RM Campinas
## 5                                  RM de Sorocaba
## 6           RM do Vale do Paraíba e Litoral Norte
## 7                                    RM São Paulo
head(as.data.frame(metro_area_saopaulo))
##   code_muni            name_muni code_state abbrev_state
## 1   3508405             Cabreúva         35           SP
## 2   3509601 Campo Limpo Paulista         35           SP
## 3   3524006              Itupeva         35           SP
## 4   3525201               Jarinu         35           SP
## 5   3525904              Jundiaí         35           SP
## 6   3527306             Louveira         35           SP
##                      name_metro type subdivision            legislation
## 1 Aglomeração Urbana de Jundiaí AGLO     NÃO TEM Lei Complementar 1.146
## 2 Aglomeração Urbana de Jundiaí AGLO     NÃO TEM Lei Complementar 1.146
## 3 Aglomeração Urbana de Jundiaí AGLO     NÃO TEM Lei Complementar 1.146
## 4 Aglomeração Urbana de Jundiaí AGLO     NÃO TEM Lei Complementar 1.146
## 5 Aglomeração Urbana de Jundiaí AGLO     NÃO TEM Lei Complementar 1.146
## 6 Aglomeração Urbana de Jundiaí AGLO     NÃO TEM Lei Complementar 1.146
##   legislation_date                           geom
## 1       24.08.2011 MULTIPOLYGON (((-47.09692 -...
## 2       24.08.2011 MULTIPOLYGON (((-46.78614 -...
## 3       24.08.2011 MULTIPOLYGON (((-47.04599 -...
## 4       24.08.2011 MULTIPOLYGON (((-46.71471 -...
## 5       24.08.2011 MULTIPOLYGON (((-46.85676 -...
## 6       24.08.2011 MULTIPOLYGON (((-46.91599 -...

However, we are still missing one final region of the macrometropolis which is Regional Unit of Bragança Paulista city. We will get this area from the municipality dataframe.

Let’s find the code_state of São Paulo, which will be the starting 2 digit codes to find the municipalities, our study area.

state <- read_state(code_state =  "all", year = 2016)
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |========                                                              |  11%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |================                                                      |  22%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |======================================================                |  78%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |======================================================================| 100%
state %>%
  filter(name_state == "São Paulo")
## Simple feature collection with 1 feature and 5 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -53.10986 ymin: -25.35794 xmax: -44.16137 ymax: -19.77966
## geographic CRS: SIRGAS 2000
##   code_state abbrev_state name_state code_region name_region
## 1         35           SP  São Paulo           3     Sudeste
##                             geom
## 1 MULTIPOLYGON (((-48.03716 -...

We can see that the code_state of São Paulo is 35.

municipality_saopaulo <- municipality %>% 
  filter(code_state == 35)

From searching of the municipalities of Regional Unit of Bragança Paulista city, we know that it is the same as the microregion of Bragança Paulista contains these municipalities:

  • Atibaia

  • Bom Jesus Dos Perdões

  • Bragança Paulista

  • Itatiba

  • Jarinu (although in the wiki, it’s part of Regional Unit of Bragança Paulista city, it is already part of Aglomeração Urbana de Jundiaí, returned from the dataset read_metro_area)

  • Joanópolis

  • Morungaba

  • Nazaré Paulista

  • Piracaia

  • Tuiuti

  • Vargem

so we will not filter for the municipality Jarinu to avoid double.

RU_Bragança_Paulista <- municipality_saopaulo %>%
  filter(name_muni %in% c("Atibaia",
                        "Bom Jesus Dos Perdões",
                        "Bragança Paulista",
                        "Itatiba",
                        "Joanópolis",
                        "Morungaba", 
                        "Nazaré Paulista",
                        "Piracaia",
                        "Tuiuti",
                        "Vargem")
  )

Now, let’s combine the study area. However, before that, we need to add the metro name of the Regional unit of Bragança Paulista.

RU_Bragança_Paulista <- RU_Bragança_Paulista %>%
  mutate(name_metro = "Regional Unit of Bragança Paulista city")
head(as.data.frame(RU_Bragança_Paulista))
##   code_muni             name_muni code_state abbrev_state
## 1   3504107               Atibaia         35           SP
## 2   3507100 Bom Jesus Dos Perdões         35           SP
## 3   3507605     Bragança Paulista         35           SP
## 4   3523404               Itatiba         35           SP
## 5   3525508            Joanópolis         35           SP
## 6   3532009             Morungaba         35           SP
##                             geom                              name_metro
## 1 MULTIPOLYGON (((-46.66146 -... Regional Unit of Bragança Paulista city
## 2 MULTIPOLYGON (((-46.47303 -... Regional Unit of Bragança Paulista city
## 3 MULTIPOLYGON (((-46.50858 -... Regional Unit of Bragança Paulista city
## 4 MULTIPOLYGON (((-46.76852 -... Regional Unit of Bragança Paulista city
## 5 MULTIPOLYGON (((-46.14383 -... Regional Unit of Bragança Paulista city
## 6 MULTIPOLYGON (((-46.80227 -... Regional Unit of Bragança Paulista city
metro_area_saopaulo <- metro_area_saopaulo %>%
  select(code_muni, name_muni, code_state, abbrev_state, name_metro, geom)

macrometro_saopaulo <- rbind(metro_area_saopaulo, RU_Bragança_Paulista)

Let’s check for duplicated values since we just use rbind() and not joining based on common values.

macrometro_saopaulo[duplicated(macrometro_saopaulo$code_muni),]
## Simple feature collection with 2 features and 5 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -46.92735 ymin: -23.10682 xmax: -46.67038 ymax: -22.83401
## geographic CRS: SIRGAS 2000
##     code_muni name_muni code_state abbrev_state
## 168   3523404   Itatiba         35           SP
## 170   3532009 Morungaba         35           SP
##                                  name_metro                           geom
## 168 Regional Unit of Bragança Paulista city MULTIPOLYGON (((-46.76852 -...
## 170 Regional Unit of Bragança Paulista city MULTIPOLYGON (((-46.80227 -...

We see that Itatiba and Morungaba are duplicates. Let’s filter for these municipalities.

macrometro_saopaulo %>%
  filter(name_muni %in% c("Itatiba", "Morungaba"))
## Simple feature collection with 4 features and 5 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -46.92735 ymin: -23.10682 xmax: -46.67038 ymax: -22.83401
## geographic CRS: SIRGAS 2000
##   code_muni name_muni code_state abbrev_state
## 1   3523404   Itatiba         35           SP
## 2   3532009 Morungaba         35           SP
## 3   3523404   Itatiba         35           SP
## 4   3532009 Morungaba         35           SP
##                                name_metro                           geom
## 1                             RM Campinas MULTIPOLYGON (((-46.76852 -...
## 2                             RM Campinas MULTIPOLYGON (((-46.80227 -...
## 3 Regional Unit of Bragança Paulista city MULTIPOLYGON (((-46.76852 -...
## 4 Regional Unit of Bragança Paulista city MULTIPOLYGON (((-46.80227 -...

Since Regional Unit of Bragança Paulista city has 10 municipalities according to wikipedia, we will remove the duplicated municipalities in the metropolitan region of Campinas.

macrometro_saopaulo <- macrometro_saopaulo[!(macrometro_saopaulo$name_muni %in% c("Itatiba", "Morungaba") & macrometro_saopaulo$name_metro == "RM Campinas"),]
macrometro_saopaulo[duplicated(macrometro_saopaulo$code_muni),]
## Simple feature collection with 0 features and 5 fields
## bbox:           xmin: NA ymin: NA xmax: NA ymax: NA
## geographic CRS: SIRGAS 2000
## [1] code_muni    name_muni    code_state   abbrev_state name_metro  
## [6] geom        
## <0 rows> (or 0-length row.names)

2.2 Base Map plot

tm_shape(macrometro_saopaulo)+
  tm_fill(col = "name_metro") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "São Paulo Macrometropolis") +
  tm_compass(type="8star", size = 2, position = c("left", "bottom")) +
  tm_scale_bar(width = 0.15, position = c("left", "bottom"))
## Some legend labels were too wide. These labels have been resized to 0.54. Increase legend.width (argument of tm_layout) to make the legend wider and therefore the labels larger.

2.3 Importing aspatial data

We will use read_csv2() function of readr package to import the csv data into R, read_cav2() function reads semicolon separated files (common in countries where , is used as the decimal place).

brazil_cities <- read_csv2("data/aspatial/BRAZIL_CITIES.csv")
brazil_cities <- brazil_cities %>%
  filter(STATE == "SP")
glimpse(brazil_cities)
## Rows: 645
## Columns: 81
## $ CITY                     <chr> "Adamantina", "Adolfo", "Aguaí", "Águas Da...
## $ STATE                    <chr> "SP", "SP", "SP", "SP", "SP", "SP", "SP", ...
## $ CAPITAL                  <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
## $ IBGE_RES_POP             <dbl> 33797, 3557, 32148, 7584, 17266, 5601, 270...
## $ IBGE_RES_POP_BRAS        <dbl> 33769, 3557, 32126, 7549, 17206, 5585, 269...
## $ IBGE_RES_POP_ESTR        <dbl> 28, 0, 22, 35, 60, 16, 14, 9, 8, 0, 0, 6, ...
## $ IBGE_DU                  <dbl> 11335, 1200, 9899, 2515, 5597, 1873, 990, ...
## $ IBGE_DU_URBAN            <dbl> 10777, 1081, 8970, 2265, 5544, 1433, 990, ...
## $ IBGE_DU_RURAL            <dbl> 558, 119, 929, 250, 53, 440, NA, 432, 391,...
## $ IBGE_POP                 <dbl> 31695, 3200, 28182, 6695, 6886, 4245, 2687...
## $ IBGE_1                   <dbl> 333, 30, 363, 84, 71, 50, 19, 433, 49, 25,...
## $ `IBGE_1-4`               <dbl> 1282, 149, 1569, 278, 293, 208, 95, 1767, ...
## $ `IBGE_5-9`               <dbl> 1803, 206, 1943, 389, 405, 290, 135, 2250,...
## $ `IBGE_10-14`             <dbl> 2089, 234, 2273, 436, 482, 375, 180, 2777,...
## $ `IBGE_15-59`             <dbl> 20651, 2079, 18608, 4268, 4411, 2631, 1592...
## $ `IBGE_60+`               <dbl> 5537, 502, 3426, 1240, 1224, 691, 666, 361...
## $ IBGE_PLANTED_AREA        <dbl> 14699, 9755, 31346, 1387, 474, 16245, 0, 1...
## $ `IBGE_CROP_PRODUCTION_$` <dbl> 69644, 67479, 223900, 8630, 6287, 132857, ...
## $ `IDHM Ranking 2010`      <dbl> 69, 1044, 1460, 124, 661, 427, 2, 662, 156...
## $ IDHM                     <chr> "0.79", "0.73", "0.715", "0.78", "0.745", ...
## $ IDHM_Renda               <chr> "0.772", "0.71", "0.703", "0.75", "0.725",...
## $ IDHM_Longevidade         <chr> "0.852", "0.844", "0.858", "0.886", "0.846...
## $ IDHM_Educacao            <chr> "0.75", "0.648", "0.606", "0.716", "0.675"...
## $ LONG                     <dbl> -5107336475, -4964972143, -4697969311, -46...
## $ LAT                      <dbl> -2168831148, -2123272978, -22059684, -2193...
## $ ALT                      <chr> "451.12", "425.39", "662.48", "832.91", "8...
## $ PAY_TV                   <dbl> 1354, 520, 1389, 606, 2522, 685, 1033, 270...
## $ FIXED_PHONES             <dbl> 7648, 271, 5019, 1803, 4393, 989, 1420, 52...
## $ AREA                     <dbl> 41199.00000, 21106.00000, 47455.00000, 142...
## $ REGIAO_TUR               <chr> "Águas Do Oeste", "Coração Do Tietê", NA, ...
## $ CATEGORIA_TUR            <chr> "C", "D", NA, "D", "B", "C", "C", "D", NA,...
## $ ESTIMATED_POP            <dbl> 35023, 3571, 35954, 8137, 18599, 6040, 338...
## $ RURAL_URBAN              <chr> "Urbano", "Rural Adjacente", "Urbano", "Ur...
## $ GVA_AGROPEC              <chr> "41899.77", "29090.08", "115600.38", "1702...
## $ GVA_INDUSTRY             <chr> "298402.33", "6.14", "146491.98", "16235.6...
## $ GVA_SERVICES             <dbl> 58763655, 2772, 30715581, 690979, 28316922...
## $ GVA_PUBLIC               <dbl> 15108903, 2101878, 11782249, 3094874, 7222...
## $ GVA_TOTAL                <dbl> 107902768, 8398, 68707, 13330883, 42463029...
## $ TAXES                    <chr> "73.41", "2.49", "77216.87", "9345.48", "3...
## $ GDP                      <dbl> 115244122, 8647, 76428753, 14265432, 45527...
## $ POP_GDP                  <dbl> 35094, 3616, 35189, 8065, 18412, 5977, 320...
## $ GDP_CAPITA               <dbl> 328387, 2391198, 217195, 1768807, 2472702,...
## $ GVA_MAIN                 <chr> "Demais serviços", "Agricultura, inclusive...
## $ MUN_EXPENDIT             <dbl> 115703289, NA, NA, 22737457, NA, 25978262,...
## $ COMP_TOT                 <dbl> 1726, 81, 799, 212, 881, 216, 202, 840, 13...
## $ COMP_A                   <dbl> 272, 10, 149, 48, 11, 60, 2, 46, 61, 31, 4...
## $ COMP_B                   <dbl> 0, 2, 9, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, ...
## $ COMP_C                   <dbl> 102, 3, 54, 18, 168, 10, 4, 91, 14, 9, 3, ...
## $ COMP_D                   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
## $ COMP_E                   <dbl> 4, 0, 3, 0, 1, 0, 1, 3, 0, 0, 0, 1, 0, 0, ...
## $ COMP_F                   <dbl> 35, 2, 21, 9, 41, 7, 6, 38, 4, 3, 1, 25, 1...
## $ COMP_G                   <dbl> 663, 33, 333, 63, 328, 68, 99, 365, 31, 37...
## $ COMP_H                   <dbl> 102, 5, 44, 7, 11, 15, 3, 50, 3, 3, 8, 64,...
## $ COMP_I                   <dbl> 99, 4, 51, 21, 92, 19, 40, 64, 8, 3, 8, 54...
## $ COMP_J                   <dbl> 41, 0, 8, 7, 5, 1, 5, 3, 2, 0, 0, 7, 0, 2,...
## $ COMP_K                   <dbl> 21, 0, 2, 0, 8, 0, 2, 5, 0, 3, 0, 2, 0, 2,...
## $ COMP_L                   <dbl> 28, 0, 5, 3, 3, 2, 1, 4, 3, 1, 0, 3, 0, 1,...
## $ COMP_M                   <dbl> 75, 2, 21, 6, 24, 5, 9, 33, 0, 4, 1, 20, 4...
## $ COMP_N                   <dbl> 79, 2, 35, 10, 96, 8, 15, 36, 2, 6, 5, 23,...
## $ COMP_O                   <dbl> 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, ...
## $ COMP_P                   <dbl> 32, 3, 12, 3, 23, 4, 3, 23, 2, 0, 3, 13, 3...
## $ COMP_Q                   <dbl> 65, 1, 21, 2, 28, 1, 3, 27, 0, 0, 6, 11, 2...
## $ COMP_R                   <dbl> 20, 3, 10, 4, 10, 5, 2, 15, 0, 0, 0, 5, 2,...
## $ COMP_S                   <dbl> 86, 9, 19, 8, 30, 8, 4, 35, 5, 5, 17, 36, ...
## $ COMP_T                   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
## $ COMP_U                   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
## $ HOTELS                   <dbl> NA, NA, NA, NA, 4, NA, NA, NA, NA, NA, NA,...
## $ BEDS                     <dbl> NA, NA, NA, NA, 723, NA, NA, NA, NA, NA, N...
## $ Pr_Agencies              <dbl> 3, 1, 3, 2, 3, 1, 1, 3, NA, 0, 1, 3, 0, 2,...
## $ Pu_Agencies              <dbl> 2, 0, 2, 1, 2, 1, 2, 2, NA, 1, 0, 3, 1, 0,...
## $ Pr_Bank                  <dbl> 3, 1, 3, 2, 3, 1, 1, 3, NA, 0, 1, 2, 0, 2,...
## $ Pu_Bank                  <dbl> 2, 0, 2, 1, 2, 1, 2, 2, NA, 1, 0, 2, 1, 0,...
## $ Pr_Assets                <dbl> 526179392, 32631770, 235543694, 61947294, ...
## $ Pu_Assets                <dbl> 823567347, 0, 198861114, 21858555, 2991064...
## $ Cars                     <dbl> 14851, 1394, 11167, 2816, 7566, 2489, 1721...
## $ Motorcycles              <dbl> 6481, 401, 5754, 945, 3644, 594, 340, 4808...
## $ Wheeled_tractor          <dbl> 4, 0, 3, 0, 0, 0, 3, 9, 3, 0, 1, 0, 0, 8, ...
## $ UBER                     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA...
## $ MAC                      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA...
## $ `WAL-MART`               <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA...
## $ POST_OFFICES             <dbl> 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 3, 1, ...

2.4 Combine geospatial and aspatial data

We will be using inner_join() function to join the 2 dataframe. We need to first join the by the city/municipality name then filter for the state of SP since there might be same city/municipality names in different states.

saopaulo <- inner_join(macrometro_saopaulo, brazil_cities, by = c("name_muni" = "CITY")) %>%
  filter(code_state == "35" & STATE == "SP")
nrow(saopaulo)
## [1] 171
nrow(macrometro_saopaulo)
## [1] 172

We can see that there’s difference in number of municipalities in the São Paulo Macrometropolis. Let’s plot the map using the combined dataframe to see the missing municipality.

tm_shape(saopaulo)+
  tm_fill(col = "name_metro") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "São Paulo Macrometropolis") +
  tm_compass(type="8star", size = 2, position = c("left", "bottom")) +
  tm_scale_bar(width = 0.15, position = c("left", "bottom"))
## Some legend labels were too wide. These labels have been resized to 0.54. Increase legend.width (argument of tm_layout) to make the legend wider and therefore the labels larger.

We can see that the missing municipality is part of the Metropolitan Region of Campinas, hence we shall derive the missing municipality.

campinas_saopaulo <- saopaulo %>%
  select(code_muni, name_muni, name_metro, STATE, CAPITAL, geom) %>%
  filter(name_metro == "RM Campinas")
campinas_saopaulo$name_muni
##  [1] "Americana"              "Artur Nogueira"         "Campinas"              
##  [4] "Cosmópolis"             "Engenheiro Coelho"      "Holambra"              
##  [7] "Hortolândia"            "Indaiatuba"             "Jaguariúna"            
## [10] "Monte Mor"              "Nova Odessa"            "Paulínia"              
## [13] "Pedreira"               "Santo Antônio De Posse" "Sumaré"                
## [16] "Valinhos"               "Vinhedo"
campinas_macrometro <- macrometro_saopaulo %>%
  filter(name_metro == "RM Campinas")
campinas_macrometro$name_muni
##  [1] "Americana"              "Artur Nogueira"         "Campinas"              
##  [4] "Cosmópolis"             "Engenheiro Coelho"      "Holambra"              
##  [7] "Hortolândia"            "Indaiatuba"             "Jaguariúna"            
## [10] "Monte Mor"              "Nova Odessa"            "Paulínia"              
## [13] "Pedreira"               "Santa Bárbara D'oeste"  "Santo Antônio De Posse"
## [16] "Sumaré"                 "Valinhos"               "Vinhedo"

We can see that the missing municipality from the combined dataframe is “Santa Bárbara D’oeste”.

macrometro_saopaulo %>%
  filter(name_muni == "Santa Bárbara D'oeste")
## Simple feature collection with 1 feature and 5 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -47.53053 ymin: -22.90827 xmax: -47.34182 ymax: -22.69927
## geographic CRS: SIRGAS 2000
##   code_muni             name_muni code_state abbrev_state  name_metro
## 1   3545803 Santa Bárbara D'oeste         35           SP RM Campinas
##                             geom
## 1 MULTIPOLYGON (((-47.38612 -...
brazil_cities %>%
  filter(CITY == "Santa Bárbara D'Oeste")
## # A tibble: 1 x 81
##   CITY  STATE CAPITAL IBGE_RES_POP IBGE_RES_POP_BR~ IBGE_RES_POP_ES~ IBGE_DU
##   <chr> <chr>   <dbl>        <dbl>            <dbl>            <dbl>   <dbl>
## 1 Sant~ SP          0       180009           179727              282   54955
## # ... with 74 more variables: IBGE_DU_URBAN <dbl>, IBGE_DU_RURAL <dbl>,
## #   IBGE_POP <dbl>, IBGE_1 <dbl>, `IBGE_1-4` <dbl>, `IBGE_5-9` <dbl>,
## #   `IBGE_10-14` <dbl>, `IBGE_15-59` <dbl>, `IBGE_60+` <dbl>,
## #   IBGE_PLANTED_AREA <dbl>, `IBGE_CROP_PRODUCTION_$` <dbl>, `IDHM Ranking
## #   2010` <dbl>, IDHM <chr>, IDHM_Renda <chr>, IDHM_Longevidade <chr>,
## #   IDHM_Educacao <chr>, LONG <dbl>, LAT <dbl>, ALT <chr>, PAY_TV <dbl>,
## #   FIXED_PHONES <dbl>, AREA <dbl>, REGIAO_TUR <chr>, CATEGORIA_TUR <chr>,
## #   ESTIMATED_POP <dbl>, RURAL_URBAN <chr>, GVA_AGROPEC <chr>,
## #   GVA_INDUSTRY <chr>, GVA_SERVICES <dbl>, GVA_PUBLIC <dbl>, GVA_TOTAL <dbl>,
## #   TAXES <chr>, GDP <dbl>, POP_GDP <dbl>, GDP_CAPITA <dbl>, GVA_MAIN <chr>,
## #   MUN_EXPENDIT <dbl>, COMP_TOT <dbl>, COMP_A <dbl>, COMP_B <dbl>,
## #   COMP_C <dbl>, COMP_D <dbl>, COMP_E <dbl>, COMP_F <dbl>, COMP_G <dbl>,
## #   COMP_H <dbl>, COMP_I <dbl>, COMP_J <dbl>, COMP_K <dbl>, COMP_L <dbl>,
## #   COMP_M <dbl>, COMP_N <dbl>, COMP_O <dbl>, COMP_P <dbl>, COMP_Q <dbl>,
## #   COMP_R <dbl>, COMP_S <dbl>, COMP_T <dbl>, COMP_U <dbl>, HOTELS <dbl>,
## #   BEDS <dbl>, Pr_Agencies <dbl>, Pu_Agencies <dbl>, Pr_Bank <dbl>,
## #   Pu_Bank <dbl>, Pr_Assets <dbl>, Pu_Assets <dbl>, Cars <dbl>,
## #   Motorcycles <dbl>, Wheeled_tractor <dbl>, UBER <dbl>, MAC <dbl>,
## #   `WAL-MART` <dbl>, POST_OFFICES <dbl>

The problem is that the spelling of the municipality is different in the aspatial dataframe brazil_cities.

The spelling is “Santa Bárbara D’Oeste” in brazil_cities and “Santa Bárbara D’oeste” in macrometro_saopaulo.

Let’s fix this!

macrometro_saopaulo$name_muni[macrometro_saopaulo$name_muni == "Santa Bárbara D'oeste"] <- "Santa Bárbara D'Oeste"
saopaulo <- inner_join(macrometro_saopaulo, brazil_cities, by = c("name_muni" = "CITY")) %>%
  filter(code_state == "35" & STATE == "SP")
nrow(saopaulo)
## [1] 172
nrow(macrometro_saopaulo)
## [1] 172

Let’s plot the map once again.

tm_shape(saopaulo)+
  tm_fill(col = "name_metro") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "São Paulo Macrometropolis") +
  tm_compass(type="8star", size = 2, position = c("left", "bottom")) +
  tm_scale_bar(width = 0.15, position = c("left", "bottom"))
## Some legend labels were too wide. These labels have been resized to 0.54. Increase legend.width (argument of tm_layout) to make the legend wider and therefore the labels larger.

2.5 Deriving Industry Location Quotient (LQ)

Since we want to analyse the distribution of spatial specialisation by industry type at municipality level in 2016, we can use Location Quotient to do that.

Location Quotient - quantifying how concentrated a particular industry, cluster, occupation, or demographic group is in a region as compared to the nation.

Assuming you are calculating LQ for industry a for municipality i. The formula is:

(number of industry a in municipality i / sum of all industry in municipality i)/(number of industry a in Greater Sao Paulo/sum of all industry in Greater Sao Paulo)

Our variables of interest related to industry specialisation would be renamed below.

saopaulo <- saopaulo %>%
  rename("AGRI_INDUSTRY" = "COMP_A",
         "EXTRACTIVE_INDUSTRY" = "COMP_B",
         "TRANSFORMATION_INDUSTRY" = "COMP_C",
         "ENERGY_INDUSTRY" = "COMP_D",
         "WATER_INDUSTRY" = "COMP_E",
         "CONSTRUCTION_INDUSTRY" = "COMP_F",
         "TRADE_REPAIR_INDUSTRY" = "COMP_G",
         "LOGISTICS_INDUSTRY" = "COMP_H",
         "ACCOMS_FOOD_INDUSTRY" = "COMP_I",
         "ICT_INDUSTRY" = "COMP_J",
         "FINANCIAL_INDUSTRY" = "COMP_K",
         "REALESTATE_INDUSTRY" = "COMP_L",
         "PROFESSIONAL_TECHNICAL_INDUSTRY" = "COMP_M",
         "ADMINISTRATIVE_INDUSTRY" = "COMP_N",
         "PUBLIC_INDUSTRY" = "COMP_O",
         "EDUCATION_INDUSTRY" = "COMP_P",
         "HEALTHCARE_INDUSTRY" = "COMP_Q",
         "ARTS_RECREATION_INDUSTRY" = "COMP_R",
         "OTHER_SERVICES_INDUSTRY" = "COMP_S",
         "DOMESTIC_INDUSTRY" = "COMP_T",
         "INTL_INDUSTRY" = "COMP_U")
head(as.data.frame(saopaulo))
##   code_muni            name_muni code_state abbrev_state
## 1   3508405             Cabreúva         35           SP
## 2   3509601 Campo Limpo Paulista         35           SP
## 3   3524006              Itupeva         35           SP
## 4   3525201               Jarinu         35           SP
## 5   3525904              Jundiaí         35           SP
## 6   3527306             Louveira         35           SP
##                      name_metro STATE CAPITAL IBGE_RES_POP IBGE_RES_POP_BRAS
## 1 Aglomeração Urbana de Jundiaí    SP       0        41604             41513
## 2 Aglomeração Urbana de Jundiaí    SP       0        74074             73873
## 3 Aglomeração Urbana de Jundiaí    SP       0        44859             44736
## 4 Aglomeração Urbana de Jundiaí    SP       0        23847             23759
## 5 Aglomeração Urbana de Jundiaí    SP       0       370126            368648
## 6 Aglomeração Urbana de Jundiaí    SP       0        37125             37062
##   IBGE_RES_POP_ESTR IBGE_DU IBGE_DU_URBAN IBGE_DU_RURAL IBGE_POP IBGE_1
## 1                91   11922         10203          1719    37633    586
## 2               201   22030         22030            NA    72014   1044
## 3               123   13300         11624          1676    38667    613
## 4                88    7097          5511          1586    18402    260
## 5              1478  118317        113645          4672   323621   3698
## 6                63   11056         10671           385    28260    432
##   IBGE_1-4 IBGE_5-9 IBGE_10-14 IBGE_15-59 IBGE_60+ IBGE_PLANTED_AREA
## 1     2392     3115       3471      24994     3075               245
## 2     4131     5264       6142      48767     6666                 0
## 3     2373     3014       3268      26496     2903              1390
## 4     1077     1420       1535      12095     2015               706
## 5    14800    18897      21530     219514    45182              2430
## 6     1661     1897       2127      20038     2105               568
##   IBGE_CROP_PRODUCTION_$ IDHM Ranking 2010  IDHM IDHM_Renda IDHM_Longevidade
## 1                   2572               832 0.738      0.717            0.828
## 2                      0               243 0.769      0.733             0.84
## 3                   5970               339 0.762       0.75            0.844
## 4                   9454               954 0.733      0.723            0.826
## 5                  63824                11  0.82      0.834            0.866
## 6                  27733               161 0.777      0.783            0.861
##   IDHM_Educacao        LONG         LAT    ALT PAY_TV FIXED_PHONES  AREA
## 1         0.678 -4713365837 -2331267439  656.6   5656         7994 26023
## 2         0.739 -4676381923 -2320939643 765.88   9589        13766  7940
## 3         0.699 -4705570115 -2315340963 672.33  10517        12333 20082
## 4         0.659 -4673827094  -231030625 794.68   5871         4655 20755
## 5         0.768 -4688527397   -23187668 760.16  92215       166371 43121
## 6         0.697 -4694644022  -230867785 690.69   4519         6929  5513
##                 REGIAO_TUR CATEGORIA_TUR ESTIMATED_POP RURAL_URBAN GVA_AGROPEC
## 1 Roteiro Dos Bandeirantes             C         48966      Urbano    25784.75
## 2                     <NA>          <NA>         83735      Urbano        7.87
## 3      Circuito Das Frutas             C         59649      Urbano    39554.78
## 4      Circuito Das Frutas             C         29456      Urbano    41414.02
## 5      Circuito Das Frutas             B        414810      Urbano   130551.25
## 6      Circuito Das Frutas             D         47748      Urbano    29487.12
##   GVA_INDUSTRY GVA_SERVICES GVA_PUBLIC  GVA_TOTAL     TAXES        GDP POP_GDP
## 1    1035198.8    201958537   19076721  327133614     870.2  414153889   47210
## 2    378706.96     81152238   28791258  148600707 189987.65  167599472   81693
## 3   1448072.53    193407002    2681091  368980641 995666.13  468547255   55596
## 4       210690    128741711   12318979  166271091 315429.36  197814027   28012
## 5    7409989.1   2311000969     184282 3249336974   7289.37 3978273572  405740
## 6    2396464.9       614022    2803914     884656 2416575.9 1126313622   44904
##   GDP_CAPITA                                                    GVA_MAIN
## 1    8772588 Comércio e reparação de veículos automotores e motocicletas
## 2    2051577                                             Demais serviços
## 3    8427715                                             Demais serviços
## 4     706176 Comércio e reparação de veículos automotores e motocicletas
## 5    9804982                                             Demais serviços
## 6   25082701 Comércio e reparação de veículos automotores e motocicletas
##   MUN_EXPENDIT COMP_TOT AGRI_INDUSTRY EXTRACTIVE_INDUSTRY
## 1    174166075     1062            23                   2
## 2    158830071     1198            16                   0
## 3           NA     1773            39                   3
## 4     94435667      802            29                   2
## 5   1630920489    16395           198                  11
## 6    350285129     1230            34                   0
##   TRANSFORMATION_INDUSTRY ENERGY_INDUSTRY WATER_INDUSTRY CONSTRUCTION_INDUSTRY
## 1                     180               0              6                    54
## 2                     151               0              2                    76
## 3                     274               1              9                    95
## 4                      73               0              2                    41
## 5                    1030               2             42                   742
## 6                     145               0              6                    70
##   TRADE_REPAIR_INDUSTRY LOGISTICS_INDUSTRY ACCOMS_FOOD_INDUSTRY ICT_INDUSTRY
## 1                   375                109                   69           12
## 2                   459                 52                   81           38
## 3                   584                101                  134           33
## 4                   298                 52                   71           27
## 5                  5431                833                 1152          648
## 6                   492                106                  102           21
##   FINANCIAL_INDUSTRY REALESTATE_INDUSTRY PROFESSIONAL_TECHNICAL_INDUSTRY
## 1                 24                  17                              30
## 2                  9                  18                              56
## 3                 25                  64                              79
## 4                  5                   8                              35
## 5                310                 458                            1292
## 6                  8                  24                              39
##   ADMINISTRATIVE_INDUSTRY PUBLIC_INDUSTRY EDUCATION_INDUSTRY
## 1                      62               2                 18
## 2                      73               2                 84
## 3                     150               4                 61
## 4                      76               2                 37
## 5                    1904               9                586
## 6                      65               4                 39
##   HEALTHCARE_INDUSTRY ARTS_RECREATION_INDUSTRY OTHER_SERVICES_INDUSTRY
## 1                  35                        4                      40
## 2                  31                       10                      40
## 3                  21                       22                      74
## 4                  15                       11                      18
## 5                 802                      230                     715
## 6                  19                       13                      43
##   DOMESTIC_INDUSTRY INTL_INDUSTRY HOTELS BEDS Pr_Agencies Pu_Agencies Pr_Bank
## 1                 0             0     NA   NA           4           2       3
## 2                 0             0     NA   NA           5           2       3
## 3                 0             0     NA   NA           3           2       3
## 4                 0             0      1   33           2           2       2
## 5                 0             0      2  344          45          20       6
## 6                 0             0     NA   NA           4           2       2
##   Pu_Bank   Pr_Assets   Pu_Assets   Cars Motorcycles Wheeled_tractor UBER MAC
## 1       2   348511458   257008134  17888        5821               7   NA  NA
## 2       2   521638595   515426440  30308        8982               8   NA  NA
## 3       2   573783053   507848296  22239        6200              12   NA   1
## 4       2   132978829   200672827  11381        4077               2   NA  NA
## 5       2 11139673441 10586167152 212118       51368             152   NA   5
## 6       2   474799597   396958740  17829        7180               3   NA  NA
##   WAL-MART POST_OFFICES                           geom
## 1       NA            4 MULTIPOLYGON (((-47.09692 -...
## 2       NA            2 MULTIPOLYGON (((-46.78614 -...
## 3       NA            1 MULTIPOLYGON (((-47.04599 -...
## 4       NA            2 MULTIPOLYGON (((-46.71471 -...
## 5       NA            7 MULTIPOLYGON (((-46.85676 -...
## 6       NA            2 MULTIPOLYGON (((-46.91599 -...

Computing total number of industry in the macrometropolis and the total number of each type of industry in the macrometropolis.

total_saopaulo_comp = sum(saopaulo$COMP_TOT)
total_agri_industry = sum(saopaulo$AGRI_INDUSTRY)
total_extractive_industry = sum(saopaulo$EXTRACTIVE_INDUSTRY)
total_transform_industry = sum(saopaulo$TRANSFORMATION_INDUSTRY)
total_energy_industry = sum(saopaulo$ENERGY_INDUSTRY)
total_water_industry = sum(saopaulo$WATER_INDUSTRY)
total_construction_industry = sum(saopaulo$CONSTRUCTION_INDUSTRY)
total_trade_repair_industry = sum(saopaulo$TRADE_REPAIR_INDUSTRY)
total_logistics_industry = sum(saopaulo$LOGISTICS_INDUSTRY)
total_accoms_food_industry = sum(saopaulo$ACCOMS_FOOD_INDUSTRY)
total_ict_industry = sum(saopaulo$ICT_INDUSTRY)
total_financial_industry = sum(saopaulo$FINANCIAL_INDUSTRY)
total_realestate_industry = sum(saopaulo$REALESTATE_INDUSTRY)
total_prof_technical_industry = sum(saopaulo$PROFESSIONAL_TECHNICAL_INDUSTRY)
total_admin_industry = sum(saopaulo$ADMINISTRATIVE_INDUSTRY)
total_public_industry = sum(saopaulo$PUBLIC_INDUSTRY)
total_education_industry = sum(saopaulo$EDUCATION_INDUSTRY)
total_healthcare_industry = sum(saopaulo$HEALTHCARE_INDUSTRY)
total_arts_recreation_industry = sum(saopaulo$ARTS_RECREATION_INDUSTRY)
total_other_services_industry = sum(saopaulo$OTHER_SERVICES_INDUSTRY)
total_domestic_industry = sum(saopaulo$DOMESTIC_INDUSTRY)
total_intl_industry = sum(saopaulo$INTL_INDUSTRY)

Computing Location Quotient of the different industries.

saopaulo <- saopaulo %>%
  mutate(LQ_AGRI_INDUSTRY = (AGRI_INDUSTRY/COMP_TOT)/(total_agri_industry/total_saopaulo_comp)) %>%
  mutate(LQ_EXTRACTIVE_INDUSTRY = (EXTRACTIVE_INDUSTRY/COMP_TOT)/(total_extractive_industry/total_saopaulo_comp)) %>%
  mutate(LQ_TRANSFORM_INDUSTRY = (TRANSFORMATION_INDUSTRY/COMP_TOT)/(total_transform_industry/total_saopaulo_comp)) %>%
  mutate(LQ_ENERGY_INDUSTRY = (ENERGY_INDUSTRY/COMP_TOT)/(total_energy_industry/total_saopaulo_comp)) %>%
  mutate(LQ_WATER_INDUSTRY = (WATER_INDUSTRY/COMP_TOT)/(total_water_industry/total_saopaulo_comp)) %>%
  mutate(LQ_CONSTRUCTION_INDUSTRY = (CONSTRUCTION_INDUSTRY/COMP_TOT)/(total_construction_industry/total_saopaulo_comp)) %>%
  mutate(LQ_TRADE_REPAIR_INDUSTRY = (TRADE_REPAIR_INDUSTRY/COMP_TOT)/(total_trade_repair_industry/total_saopaulo_comp)) %>%
  mutate(LQ_LOGISTICS_INDUSTRY = (LOGISTICS_INDUSTRY/COMP_TOT)/(total_logistics_industry/total_saopaulo_comp)) %>%
  mutate(LQ_ACCOMS_FOOD_INDUSTRY = (ACCOMS_FOOD_INDUSTRY/COMP_TOT)/(total_accoms_food_industry/total_saopaulo_comp)) %>% 
  mutate(LQ_ICT_INDUSTRY = (ICT_INDUSTRY/COMP_TOT)/(total_ict_industry/total_saopaulo_comp)) %>%
  mutate(LQ_FINANCIAL_INDUSTRY = (FINANCIAL_INDUSTRY/COMP_TOT)/(total_financial_industry/total_saopaulo_comp)) %>%
  mutate(LQ_REALESTATE_INDUSTRY = (REALESTATE_INDUSTRY/COMP_TOT)/(total_realestate_industry/total_saopaulo_comp)) %>%
  mutate(LQ_PROF_TECHNICAL_INDUSTRY = (PROFESSIONAL_TECHNICAL_INDUSTRY/COMP_TOT)/(total_prof_technical_industry/total_saopaulo_comp)) %>%
  mutate(LQ_ADMIN_INDUSTRY = (ADMINISTRATIVE_INDUSTRY/COMP_TOT)/(total_admin_industry/total_saopaulo_comp)) %>%
  mutate(LQ_PUBLIC_INDUSTRY = (PUBLIC_INDUSTRY/COMP_TOT)/(total_public_industry/total_saopaulo_comp)) %>%
  mutate(LQ_EDUCATION_INDUSTRY = (EDUCATION_INDUSTRY/COMP_TOT)/(total_education_industry/total_saopaulo_comp)) %>%
  mutate(LQ_HEALTHCARE_INDUSTRY = (HEALTHCARE_INDUSTRY/COMP_TOT)/(total_healthcare_industry/total_saopaulo_comp)) %>%
  mutate(LQ_ARTS_RECREATION_INDUSTRY = (ARTS_RECREATION_INDUSTRY/COMP_TOT)/(total_arts_recreation_industry/total_saopaulo_comp)) %>%
  mutate(LQ_OTHER_SERVICES_INDUSTRY = (OTHER_SERVICES_INDUSTRY/COMP_TOT)/(total_other_services_industry/total_saopaulo_comp)) %>%
  mutate(LQ_DOMESTIC_INDUSTRY = (DOMESTIC_INDUSTRY/COMP_TOT)/(total_domestic_industry/total_saopaulo_comp)) %>%
  mutate(LQ_INTL_INDUSTRY = (INTL_INDUSTRY/COMP_TOT)/(total_intl_industry/total_saopaulo_comp))

Since the domestic industry variable only has 0 as it’s value, we will drop it from our saopaulo dataframe.

saopaulo <- saopaulo %>%
  select(-DOMESTIC_INDUSTRY, -LQ_DOMESTIC_INDUSTRY)
head(as.data.frame(saopaulo)[85:105])
##   LQ_AGRI_INDUSTRY LQ_EXTRACTIVE_INDUSTRY LQ_TRANSFORM_INDUSTRY
## 1        1.6967505               3.647449             2.4430635
## 2        1.0463521               0.000000             1.8167991
## 3        1.7233383               3.277149             2.2275559
## 4        2.8329460               4.829913             1.3120043
## 5        0.9461684               1.299466             0.9055503
## 6        2.1656510               0.000000             1.6992202
##   LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY LQ_CONSTRUCTION_INDUSTRY
## 1          0.0000000         2.8858388                1.0267469
## 2          0.0000000         0.8527437                1.2810053
## 3          1.5906631         2.5928602                1.0819546
## 4          0.0000000         1.2737992                1.0322946
## 5          0.3440373         1.3085285                0.9138747
## 6          0.0000000         2.4916754                1.1491774
##   LQ_TRADE_REPAIR_INDUSTRY LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
## 1                 1.087693              2.342976                1.003421
## 2                 1.180199              0.990860                1.044208
## 3                 1.014620              1.300404                1.167226
## 4                 1.144567              1.480113                1.367234
## 5                 1.020394              1.159843                1.085175
## 6                 1.232138              1.967282                1.280719
##   LQ_ICT_INDUSTRY LQ_FINANCIAL_INDUSTRY LQ_REALESTATE_INDUSTRY
## 1       0.2177898             0.7511227              0.7174177
## 2       0.6113749             0.2496950              0.6733849
## 3       0.3587452             0.4686574              1.6177781
## 4       0.6488888             0.2072143              0.4470574
## 5       0.7618061             0.6284554              1.2519926
## 6       0.3290751             0.2161768              0.8744880
##   LQ_PROF_TECHNICAL_INDUSTRY LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY
## 1                  0.3866436         0.4603496          3.0144632
## 2                  0.6398015         0.4804926          2.6722537
## 3                  0.6098632         0.6671188          3.6112351
## 4                  0.5973209         0.7472396          3.9917206
## 5                  1.0786117         0.9157484          0.8786898
## 6                  0.4339838         0.4167052          5.2054632
##   LQ_EDUCATION_INDUSTRY LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
## 1             0.5311049              0.8930439                   0.3053556
## 2             2.1971252              0.7011875                   0.6767271
## 3             1.0780861              0.3209518                   1.0059683
## 4             1.4456384              0.5068112                   1.1119588
## 5             1.1200013              1.3255381                   1.1373307
## 6             0.9935548              0.4185793                   0.8568575
##   LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY                           geom
## 1                  0.8132191                0 MULTIPOLYGON (((-47.09692 -...
## 2                  0.7209004                0 MULTIPOLYGON (((-46.78614 -...
## 3                  0.9011458                0 MULTIPOLYGON (((-47.04599 -...
## 4                  0.4845853                0 MULTIPOLYGON (((-46.71471 -...
## 5                  0.9416006                0 MULTIPOLYGON (((-46.85676 -...
## 6                  0.7548062                0 MULTIPOLYGON (((-46.91599 -...

3. Exploratory Data Analysis (EDA)

3.1 EDA using statistical graphics

We will plot the overall distribution of the newly derived variables of Location Quotient using Histogram, geom_histogram() function of ggplot2 package.

LQ_AGRI <- ggplot(data = saopaulo,
                  aes(x = `LQ_AGRI_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.7) 
LQ_EXTRACTIVE <- ggplot(data = saopaulo,
                  aes(x = `LQ_EXTRACTIVE_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.7) 
LQ_TRANSFORM <- ggplot(data = saopaulo,
                  aes(x = `LQ_TRANSFORM_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_ENERGY <- ggplot(data = saopaulo,
                  aes(x = `LQ_ENERGY_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.7) 
LQ_WATER <- ggplot(data = saopaulo,
                  aes(x = `LQ_WATER_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.5) 
LQ_CONSTRUCTION <- ggplot(data = saopaulo,
                  aes(x = `LQ_CONSTRUCTION_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_TRADE_REPAIR <- ggplot(data = saopaulo,
                  aes(x = `LQ_TRADE_REPAIR_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_LOGISTICS <- ggplot(data = saopaulo,
                  aes(x = `LQ_LOGISTICS_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_ACCOMS_FOOD <- ggplot(data = saopaulo,
                  aes(x = `LQ_ACCOMS_FOOD_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_ICT <- ggplot(data = saopaulo,
                  aes(x = `LQ_ICT_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.3) 
LQ_FINANCIAL <- ggplot(data = saopaulo,
                  aes(x = `LQ_FINANCIAL_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_REALESTATE <- ggplot(data = saopaulo,
                  aes(x = `LQ_REALESTATE_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_PROF_TECHNICAL <- ggplot(data = saopaulo,
                  aes(x = `LQ_PROF_TECHNICAL_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_ADMIN <- ggplot(data = saopaulo,
                  aes(x = `LQ_ADMIN_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_PUBLIC <- ggplot(data = saopaulo,
                  aes(x = `LQ_PUBLIC_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.8) 
LQ_EDUCATION <- ggplot(data = saopaulo,
                  aes(x = `LQ_EDUCATION_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1)
LQ_HEALTHCARE <- ggplot(data = saopaulo,
                  aes(x = `LQ_HEALTHCARE_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_ARTS_RECREATION <- ggplot(data = saopaulo,
                  aes(x = `LQ_ARTS_RECREATION_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_OTHER_SERVICES <- ggplot(data = saopaulo,
                  aes(x = `LQ_OTHER_SERVICES_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.1) 
LQ_INTL <- ggplot(data = saopaulo,
                  aes(x = `LQ_INTL_INDUSTRY`)) +
  geom_histogram(color = "blue", fill = "light blue", binwidth = 0.3) 

We will display the plots using ggarange() function of ggpubr package.

We can see differing overall distributions of the Location Quotient of the variables. Some are really skewed to the right such as LQ_ICT_INDUSTRY, LQ_AGRI_INDUSTRY and LQ_EXTRACTIVE_INDUSTRY. Some are more normally distributed such as LQ_CONSTRUCTION_INDUSTRY, LQ_TRANSFORM_INDUSTRY and LQ_TRADE_REPAIR_INDUSTRY

3.2 EDA with choropleth maps

To plot the choropleth maps, we will use tmap functions while changing the col value for tm_fill as well as the title of the plots.

AGRI.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_AGRI_INDUSTRY",
          style = "pretty",
          title = "Agriculture LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Agriculture Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

EXTRACTIVE.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_EXTRACTIVE_INDUSTRY",
          style = "pretty",
          title = "Extractive LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Extractive Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

TRANSFORM.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_TRANSFORM_INDUSTRY",
          style = "pretty",
          title = "Transformation LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Transformation Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

ENERGY.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_ENERGY_INDUSTRY",
          style = "pretty",
          title = "Energy LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Energy Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

WATER.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_WATER_INDUSTRY",
          style = "pretty",
          title = "Water LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Water Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

CONSTRUCTION.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_CONSTRUCTION_INDUSTRY",
          style = "pretty",
          title = "Construction LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Construction Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

TRADEREPAIR.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_TRADE_REPAIR_INDUSTRY",
          style = "pretty",
          title = "Trade & Repair LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Trade & Repair Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

LOGISTICS.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_LOGISTICS_INDUSTRY",
          style = "pretty",
          title = "Logistics LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Logistics Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

ACCOMSFOOD.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_ACCOMS_FOOD_INDUSTRY",
          style = "pretty",
          title = "Accoms & Food LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Accoms & Food Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

ICT.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_ICT_INDUSTRY",
          style = "pretty",
          title = "ICT LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "ICT Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

FINANCIAL.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_FINANCIAL_INDUSTRY",
          style = "pretty",
          title = "Financial LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Financial Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

REALESTATE.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_REALESTATE_INDUSTRY",
          style = "pretty",
          title = "Real Estate LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Real Estate Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

PROFTECHNICAL.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_PROF_TECHNICAL_INDUSTRY",
          style = "pretty",
          title = "Professional Technical LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Professional, Technical Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

ADMIN.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_ADMIN_INDUSTRY",
          style = "pretty",
          title = "Administrative LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Administrative Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

PUBLIC.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_PUBLIC_INDUSTRY",
          style = "pretty",
          title = "Public admin LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Public administrative Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

EDUCATION.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_EDUCATION_INDUSTRY",
          style = "pretty",
          title = "Education LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Education Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

HEALTHCARE.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_HEALTHCARE_INDUSTRY",
          style = "pretty",
          title = "Healthcare LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Healthcare & social Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

ARTSRECREATION.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_ARTS_RECREATION_INDUSTRY",
          style = "pretty",
          title = "Arts & Recreation LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Arts, Recreation Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

OTHERSERVICES.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_OTHER_SERVICES_INDUSTRY",
          style = "pretty",
          title = "Other Services LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "Other Services Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

INTL.map <- tm_shape(saopaulo)+
  tm_fill(col = "LQ_INTL_INDUSTRY",
          style = "pretty",
          title = "International institutions LQ value") +
  tm_borders(lwd=0.5)+
  tm_layout(legend.height = 0.45, 
            legend.width = 0.35,
            frame = FALSE,
            main.title = "International institutions Industry LQ",
            main.title.position = "center",
            main.title.size = 1)

3.3 Correlation Analysis

Before performing cluster analysis, it is important for us to ensure that the chosen cluster variables are not highly correlated. We will do this using corrplot.mixed() function of corrplot package to visualise and analyse the correlation of the input variables.

Before that, we also select the desired cluster variables and also remove the geom variable (sf object) because we only want the variables in tibble/dataframe format.

cluster_var <- saopaulo %>%
  select(name_muni, name_metro, contains("LQ_"))
cluster_var <- st_set_geometry(cluster_var, NULL)
cluster_vars.cor = cor(as.tibble(cluster_var[,3:22]))
corrplot.mixed(cluster_vars.cor,
               lower = "ellipse",
               upper = "number",
               tl.pos = "lt",
               diag = "l",
               tl.col = "black",
               tl.cex = 0.5,
               number.cex = 0.5)

We can see that there are only a few correlation that results in a value of higher than 0.6 such as the correlation between professional, technical industry LQ and the financial industry LQ (0.61) and the correlation between trade, repair industry LQ and the agricultural industry LQ (0.62). However, since these values are still relatively low, we will not remove them from our clustering variables.

4. Hierarchy Cluster Analysis

4.1 Data standardisation

In order to avoid cluster analysis result to be biased to the clustering variables with large values, it’s useful to standardise the input variables before performing cluster analysis.

We will use the Min-Max standardisation method to standardise the variables into a range between 0 to 1.

row.names(cluster_var) <- cluster_var$name_muni
saopaulo_industry <- select(cluster_var, c(3:22))
head(as.data.frame(saopaulo_industry))
##                      LQ_AGRI_INDUSTRY LQ_EXTRACTIVE_INDUSTRY
## Cabreúva                    1.6967505               3.647449
## Campo Limpo Paulista        1.0463521               0.000000
## Itupeva                     1.7233383               3.277149
## Jarinu                      2.8329460               4.829913
## Jundiaí                     0.9461684               1.299466
## Louveira                    2.1656510               0.000000
##                      LQ_TRANSFORM_INDUSTRY LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY
## Cabreúva                         2.4430635          0.0000000         2.8858388
## Campo Limpo Paulista             1.8167991          0.0000000         0.8527437
## Itupeva                          2.2275559          1.5906631         2.5928602
## Jarinu                           1.3120043          0.0000000         1.2737992
## Jundiaí                          0.9055503          0.3440373         1.3085285
## Louveira                         1.6992202          0.0000000         2.4916754
##                      LQ_CONSTRUCTION_INDUSTRY LQ_TRADE_REPAIR_INDUSTRY
## Cabreúva                            1.0267469                 1.087693
## Campo Limpo Paulista                1.2810053                 1.180199
## Itupeva                             1.0819546                 1.014620
## Jarinu                              1.0322946                 1.144567
## Jundiaí                             0.9138747                 1.020394
## Louveira                            1.1491774                 1.232138
##                      LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
## Cabreúva                          2.342976                1.003421
## Campo Limpo Paulista              0.990860                1.044208
## Itupeva                           1.300404                1.167226
## Jarinu                            1.480113                1.367234
## Jundiaí                           1.159843                1.085175
## Louveira                          1.967282                1.280719
##                      LQ_ICT_INDUSTRY LQ_FINANCIAL_INDUSTRY
## Cabreúva                   0.2177898             0.7511227
## Campo Limpo Paulista       0.6113749             0.2496950
## Itupeva                    0.3587452             0.4686574
## Jarinu                     0.6488888             0.2072143
## Jundiaí                    0.7618061             0.6284554
## Louveira                   0.3290751             0.2161768
##                      LQ_REALESTATE_INDUSTRY LQ_PROF_TECHNICAL_INDUSTRY
## Cabreúva                          0.7174177                  0.3866436
## Campo Limpo Paulista              0.6733849                  0.6398015
## Itupeva                           1.6177781                  0.6098632
## Jarinu                            0.4470574                  0.5973209
## Jundiaí                           1.2519926                  1.0786117
## Louveira                          0.8744880                  0.4339838
##                      LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY LQ_EDUCATION_INDUSTRY
## Cabreúva                     0.4603496          3.0144632             0.5311049
## Campo Limpo Paulista         0.4804926          2.6722537             2.1971252
## Itupeva                      0.6671188          3.6112351             1.0780861
## Jarinu                       0.7472396          3.9917206             1.4456384
## Jundiaí                      0.9157484          0.8786898             1.1200013
## Louveira                     0.4167052          5.2054632             0.9935548
##                      LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
## Cabreúva                          0.8930439                   0.3053556
## Campo Limpo Paulista              0.7011875                   0.6767271
## Itupeva                           0.3209518                   1.0059683
## Jarinu                            0.5068112                   1.1119588
## Jundiaí                           1.3255381                   1.1373307
## Louveira                          0.4185793                   0.8568575
##                      LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY
## Cabreúva                              0.8132191                0
## Campo Limpo Paulista                  0.7209004                0
## Itupeva                               0.9011458                0
## Jarinu                                0.4845853                0
## Jundiaí                               0.9416006                0
## Louveira                              0.7548062                0
saopaulo_industry.std <- normalize(saopaulo_industry)
#summary(saopaulo_industry.std)
head(saopaulo_industry.std)
##                      LQ_AGRI_INDUSTRY LQ_EXTRACTIVE_INDUSTRY
## Cabreúva                   0.02672078             0.03954802
## Campo Limpo Paulista       0.01647817             0.00000000
## Itupeva                    0.02713949             0.03553299
## Jarinu                     0.04461382             0.05236908
## Jundiaí                    0.01490045             0.01408966
## Louveira                   0.03410512             0.00000000
##                      LQ_TRANSFORM_INDUSTRY LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY
## Cabreúva                         0.6719128        0.000000000        0.21280603
## Campo Limpo Paulista             0.4996721        0.000000000        0.06288258
## Itupeva                          0.6126420        0.033276932        0.19120135
## Jarinu                           0.3608390        0.000000000        0.09393184
## Jundiaí                          0.2490524        0.007197316        0.09649283
## Louveira                         0.4673345        0.000000000        0.18373984
##                      LQ_CONSTRUCTION_INDUSTRY LQ_TRADE_REPAIR_INDUSTRY
## Cabreúva                            0.5159912                0.4414358
## Campo Limpo Paulista                0.6437686                0.4899604
## Itupeva                             0.5437357                0.4031055
## Jarinu                              0.5187791                0.4712696
## Jundiaí                             0.4592673                0.4061340
## Louveira                            0.5775186                0.5172052
##                      LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
## Cabreúva                         0.5918707               0.1694573
## Campo Limpo Paulista             0.2503061               0.1791364
## Itupeva                          0.3285016               0.2083299
## Jarinu                           0.3738986               0.2557939
## Jundiaí                          0.2929938               0.1888584
## Louveira                         0.4969648               0.2352630
##                      LQ_ICT_INDUSTRY LQ_FINANCIAL_INDUSTRY
## Cabreúva                  0.02708077            0.34485325
## Campo Limpo Paulista      0.07602056            0.11463924
## Itupeva                   0.04460766            0.21516859
## Jarinu                    0.08068516            0.09513564
## Jundiaí                   0.09472570            0.28853458
## Louveira                  0.04091838            0.09925045
##                      LQ_REALESTATE_INDUSTRY LQ_PROF_TECHNICAL_INDUSTRY
## Cabreúva                          0.3881827                  0.1563147
## Campo Limpo Paulista              0.3643573                  0.2586630
## Itupeva                           0.8753525                  0.2465593
## Jarinu                            0.2418953                  0.2414887
## Jundiaí                           0.6774321                  0.4360680
## Louveira                          0.4731707                  0.1754537
##                      LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY LQ_EDUCATION_INDUSTRY
## Cabreúva                     0.1741319        0.020097326             0.2417272
## Campo Limpo Paulista         0.1817511        0.017580076             1.0000000
## Itupeva                      0.2523443        0.024487105             0.4906803
## Jarinu                       0.2826508        0.027285909             0.6579682
## Jundiaí                      0.3463910        0.004386845             0.5097576
## Louveira                     0.1576229        0.036214048             0.4522067
##                      LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
## Cabreúva                          0.4909701                   0.1603892
## Campo Limpo Paulista              0.3854929                   0.3554535
## Itupeva                           0.1764502                   0.5283888
## Jarinu                            0.2786303                   0.5840607
## Jundiaí                           0.7287431                   0.5973874
## Louveira                          0.2301230                   0.4500678
##                      LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY
## Cabreúva                              0.2955586                0
## Campo Limpo Paulista                  0.2545483                0
## Itupeva                               0.3346178                0
## Jarinu                                0.1495713                0
## Jundiaí                               0.3525888                0
## Louveira                              0.2696101                0
describe(saopaulo_industry.std)
##                             vars   n mean   sd median trimmed  mad min max
## LQ_AGRI_INDUSTRY               1 172 0.11 0.19   0.03    0.06 0.04   0   1
## LQ_EXTRACTIVE_INDUSTRY         2 172 0.06 0.12   0.02    0.03 0.02   0   1
## LQ_TRANSFORM_INDUSTRY          3 172 0.34 0.19   0.30    0.32 0.17   0   1
## LQ_ENERGY_INDUSTRY             4 172 0.01 0.08   0.00    0.00 0.00   0   1
## LQ_WATER_INDUSTRY              5 172 0.11 0.13   0.09    0.09 0.08   0   1
## LQ_CONSTRUCTION_INDUSTRY       6 172 0.46 0.20   0.46    0.45 0.17   0   1
## LQ_TRADE_REPAIR_INDUSTRY       7 172 0.47 0.14   0.48    0.48 0.09   0   1
## LQ_LOGISTICS_INDUSTRY          8 172 0.30 0.19   0.25    0.27 0.13   0   1
## LQ_ACCOMS_FOOD_INDUSTRY        9 172 0.22 0.14   0.18    0.20 0.07   0   1
## LQ_ICT_INDUSTRY               10 172 0.06 0.09   0.04    0.04 0.02   0   1
## LQ_FINANCIAL_INDUSTRY         11 172 0.17 0.14   0.15    0.16 0.09   0   1
## LQ_REALESTATE_INDUSTRY        12 172 0.32 0.20   0.31    0.31 0.22   0   1
## LQ_PROF_TECHNICAL_INDUSTRY    13 172 0.22 0.12   0.20    0.20 0.09   0   1
## LQ_ADMIN_INDUSTRY             14 172 0.22 0.16   0.20    0.20 0.11   0   1
## LQ_PUBLIC_INDUSTRY            15 172 0.05 0.10   0.02    0.03 0.02   0   1
## LQ_EDUCATION_INDUSTRY         16 172 0.45 0.19   0.46    0.45 0.21   0   1
## LQ_HEALTHCARE_INDUSTRY        17 172 0.34 0.20   0.31    0.32 0.16   0   1
## LQ_ARTS_RECREATION_INDUSTRY   18 172 0.47 0.21   0.49    0.48 0.17   0   1
## LQ_OTHER_SERVICES_INDUSTRY    19 172 0.34 0.15   0.34    0.33 0.12   0   1
## LQ_INTL_INDUSTRY              20 172 0.01 0.09   0.00    0.00 0.00   0   1
##                             range  skew kurtosis   se
## LQ_AGRI_INDUSTRY                1  2.61     7.05 0.01
## LQ_EXTRACTIVE_INDUSTRY          1  3.82    20.35 0.01
## LQ_TRANSFORM_INDUSTRY           1  0.80     0.39 0.01
## LQ_ENERGY_INDUSTRY              1 10.74   126.44 0.01
## LQ_WATER_INDUSTRY               1  3.70    20.23 0.01
## LQ_CONSTRUCTION_INDUSTRY        1  0.09    -0.04 0.02
## LQ_TRADE_REPAIR_INDUSTRY        1 -0.33     2.51 0.01
## LQ_LOGISTICS_INDUSTRY           1  1.44     2.08 0.01
## LQ_ACCOMS_FOOD_INDUSTRY         1  2.38     7.54 0.01
## LQ_ICT_INDUSTRY                 1  7.61    71.15 0.01
## LQ_FINANCIAL_INDUSTRY           1  2.11     9.18 0.01
## LQ_REALESTATE_INDUSTRY          1  0.44    -0.06 0.02
## LQ_PROF_TECHNICAL_INDUSTRY      1  2.07     9.16 0.01
## LQ_ADMIN_INDUSTRY               1  2.28     7.46 0.01
## LQ_PUBLIC_INDUSTRY              1  6.19    52.96 0.01
## LQ_EDUCATION_INDUSTRY           1  0.11    -0.12 0.01
## LQ_HEALTHCARE_INDUSTRY          1  0.81     0.88 0.02
## LQ_ARTS_RECREATION_INDUSTRY     1 -0.37     0.28 0.02
## LQ_OTHER_SERVICES_INDUSTRY      1  0.85     2.09 0.01
## LQ_INTL_INDUSTRY                1  9.84   104.39 0.01

We also standardize the clustering variables using Z-score method in case it is needed, Z-score method deals with anomalies better even though the resulting clustering variables will not come in a range between 0 to 1.

saopaulo_industry.z <- scale(saopaulo_industry)
describe(saopaulo_industry.z)
##                             vars   n mean sd median trimmed  mad   min   max
## LQ_AGRI_INDUSTRY               1 172    0  1  -0.43   -0.25 0.19 -0.58  4.69
## LQ_EXTRACTIVE_INDUSTRY         2 172    0  1  -0.39   -0.24 0.18 -0.51  7.63
## LQ_TRANSFORM_INDUSTRY          3 172    0  1  -0.21   -0.08 0.89 -1.74  3.42
## LQ_ENERGY_INDUSTRY             4 172    0  1  -0.18   -0.16 0.00 -0.18 12.21
## LQ_WATER_INDUSTRY              5 172    0  1  -0.19   -0.15 0.60 -0.89  7.11
## LQ_CONSTRUCTION_INDUSTRY       6 172    0  1   0.01   -0.01 0.85 -2.31  2.76
## LQ_TRADE_REPAIR_INDUSTRY       7 172    0  1   0.04    0.04 0.67 -3.46  3.87
## LQ_LOGISTICS_INDUSTRY          8 172    0  1  -0.24   -0.15 0.67 -1.56  3.71
## LQ_ACCOMS_FOOD_INDUSTRY        9 172    0  1  -0.25   -0.16 0.49 -1.53  5.42
## LQ_ICT_INDUSTRY               10 172    0  1  -0.16   -0.15 0.24 -0.62 10.49
## LQ_FINANCIAL_INDUSTRY         11 172    0  1  -0.13   -0.09 0.67 -1.27  6.11
## LQ_REALESTATE_INDUSTRY        12 172    0  1  -0.02   -0.04 1.09 -1.56  3.34
## LQ_PROF_TECHNICAL_INDUSTRY    13 172    0  1  -0.15   -0.10 0.73 -1.76  6.32
## LQ_ADMIN_INDUSTRY             14 172    0  1  -0.15   -0.14 0.72 -1.41  4.98
## LQ_PUBLIC_INDUSTRY            15 172    0  1  -0.31   -0.20 0.25 -0.52  9.82
## LQ_EDUCATION_INDUSTRY         16 172    0  1   0.05   -0.01 1.09 -2.34  2.82
## LQ_HEALTHCARE_INDUSTRY        17 172    0  1  -0.11   -0.07 0.83 -1.70  3.36
## LQ_ARTS_RECREATION_INDUSTRY   18 172    0  1   0.11    0.05 0.81 -2.27  2.56
## LQ_OTHER_SERVICES_INDUSTRY    19 172    0  1  -0.05   -0.05 0.80 -2.23  4.26
## LQ_INTL_INDUSTRY              20 172    0  1  -0.12   -0.12 0.00 -0.12 11.53
##                             range  skew kurtosis   se
## LQ_AGRI_INDUSTRY             5.26  2.61     7.05 0.08
## LQ_EXTRACTIVE_INDUSTRY       8.14  3.82    20.35 0.08
## LQ_TRANSFORM_INDUSTRY        5.16  0.80     0.39 0.08
## LQ_ENERGY_INDUSTRY          12.38 10.74   126.44 0.08
## LQ_WATER_INDUSTRY            8.00  3.70    20.23 0.08
## LQ_CONSTRUCTION_INDUSTRY     5.07  0.09    -0.04 0.08
## LQ_TRADE_REPAIR_INDUSTRY     7.33 -0.33     2.51 0.08
## LQ_LOGISTICS_INDUSTRY        5.28  1.44     2.08 0.08
## LQ_ACCOMS_FOOD_INDUSTRY      6.95  2.38     7.54 0.08
## LQ_ICT_INDUSTRY             11.11  7.61    71.15 0.08
## LQ_FINANCIAL_INDUSTRY        7.38  2.11     9.18 0.08
## LQ_REALESTATE_INDUSTRY       4.89  0.44    -0.06 0.08
## LQ_PROF_TECHNICAL_INDUSTRY   8.08  2.07     9.16 0.08
## LQ_ADMIN_INDUSTRY            6.39  2.28     7.46 0.08
## LQ_PUBLIC_INDUSTRY          10.34  6.19    52.96 0.08
## LQ_EDUCATION_INDUSTRY        5.16  0.11    -0.12 0.08
## LQ_HEALTHCARE_INDUSTRY       5.06  0.81     0.88 0.08
## LQ_ARTS_RECREATION_INDUSTRY  4.84 -0.37     0.28 0.08
## LQ_OTHER_SERVICES_INDUSTRY   6.49  0.85     2.09 0.08
## LQ_INTL_INDUSTRY            11.66  9.84   104.39 0.08

4.2 Visualising standardised clustering variables

minmax_agri <- ggplot(as.data.frame(saopaulo_industry.std),
       aes(x = `LQ_AGRI_INDUSTRY`)) +
  geom_histogram(color = "red", 
                 fill = "pink", 
                 binwidth =  0.1) +
  ggtitle("Min-Max Standardisation")
z_agri <- ggplot(as.data.frame(saopaulo_industry.z),
       aes(x = `LQ_AGRI_INDUSTRY`)) +
  geom_histogram(color = "red", 
                 fill = "pink", 
                 binwidth =  0.1) +
  ggtitle("Z-score Standardisation")

minmax_extract <- ggplot(as.data.frame(saopaulo_industry.std),
       aes(x = `LQ_EXTRACTIVE_INDUSTRY`)) +
  geom_histogram(color = "red", 
                 fill = "pink", 
                 binwidth =  0.1) +
  ggtitle("Min-Max Standardisation")

z_extract <- ggplot(as.data.frame(saopaulo_industry.z),
       aes(x = `LQ_EXTRACTIVE_INDUSTRY`)) +
  geom_histogram(color = "red", 
                 fill = "pink", 
                 binwidth =  0.1) +
  ggtitle("Z-score Standardisation")
ggarrange(LQ_AGRI, minmax_agri, z_agri, LQ_EXTRACTIVE, minmax_extract, z_extract,
          ncol = 3,
          nrow = 2)

These 2 Industry Location Quotient, agriculture industry LQ and extractive industry LQ, were very skewed before data standardization. However, both are still skewed after standardization using both min-max method and z-score method. However, these are due to outliers which are normal since different municipalities have different industry specialization.

4.3 Computing proximity matrix

We will calculate the distance matrix using dist() of Base R, where method to be used is “euclidean”.

proxmat <- dist(saopaulo_industry, method = "euclidean")

4.4 Computing hierarchical clustering

Next, we will use hclust() of stats package to perform hierarchical cluster analysis of the proximity matrix using “ward.D” for its clustering algorithm.

hclust_ward <- hclust(proxmat, method = "ward.D")
plot(hclust_ward, cex = 0.4)

4.5 Selecting optimal clustering algorithm

We will use the agnes() function of cluster package to get the agglomerative coefficient of different clustering algorithms.

m <- c( "average", "single", "complete", "ward")
names(m) <- c( "average", "single", "complete", "ward")

ac <- function(x) {
  agnes(saopaulo_industry, method = x)$ac
}

map_dbl(m, ac)
##   average    single  complete      ward 
## 0.9561122 0.9511566 0.9585075 0.9705217

We caan see that all the hierarchical clustering algorithms perform well but we will choose the one with the highest result which is ward. Hence, ward method will be used.

4.6 Determining optimal clusters

To determine the optimal clusters, we will use the gap statistic method, which compares the total within intra-cluster variation for different values of k with their expected values under null reference distribution of the data.

This will return the gap statistic, the largest gap statistic means that the clusters are far away from the random uniform distribution of points.

We will use clusGap() function of cluster package to compute the gap statistics. B argument is the number of monte carlo samples while K.max is the maximum number of clusters to consider.

set.seed(12345)
gap_stat <- clusGap(saopaulo_industry, FUN = hcut, nstart = 25, K.max = 20, B = 100)
print(gap_stat, method = "firstmax")
## Clustering Gap statistic ["clusGap"] from call:
## clusGap(x = saopaulo_industry, FUNcluster = hcut, K.max = 20,     B = 100, nstart = 25)
## B=100 simulated reference sets, k = 1..20; spaceH0="scaledPCA"
##  --> Number of clusters (method 'firstmax'): 2
##           logW   E.logW      gap     SE.sim
##  [1,] 6.818823 8.120307 1.301484 0.02203295
##  [2,] 6.553872 7.946781 1.392909 0.02625644
##  [3,] 6.473871 7.843966 1.370095 0.02281273
##  [4,] 6.309323 7.755602 1.446279 0.02366855
##  [5,] 6.256093 7.681333 1.425239 0.02281774
##  [6,] 6.201907 7.615371 1.413464 0.02123337
##  [7,] 6.072386 7.559672 1.487286 0.01863795
##  [8,] 5.992717 7.511456 1.518738 0.01746740
##  [9,] 5.909477 7.468575 1.559098 0.01656932
## [10,] 5.867516 7.430681 1.563166 0.01661111
## [11,] 5.820004 7.395299 1.575295 0.01683447
## [12,] 5.775048 7.362825 1.587778 0.01675116
## [13,] 5.684131 7.331864 1.647733 0.01672285
## [14,] 5.645991 7.302874 1.656883 0.01659002
## [15,] 5.612908 7.275251 1.662343 0.01671317
## [16,] 5.551638 7.248844 1.697206 0.01681075
## [17,] 5.506684 7.223094 1.716411 0.01750255
## [18,] 5.466653 7.198399 1.731746 0.01787528
## [19,] 5.432633 7.174559 1.741926 0.01820935
## [20,] 5.401688 7.151390 1.749702 0.01839030

Then, we will visualize the gap statistics generated by the clusGap() function of cluster package using fviz_gap_stat() function of factoextraa package

fviz_gap_stat(gap_stat)

We can see that the recommended cluster is 2 but we know that it’s too small to get insights from the analysis.

We can also observe that from k = 9 onward, the gap statistic keeps on increasing and anything beyong 10 clusters will give heterogeneous clusters so we shall set our cluster k to 9.

4.7 Interactive cluster heatmap

We will visualize the hierarchical clustering analysis result in another way, which is by interactive heatmap using the heatmaply() function of heatmaply package.

saopaulo_industry_matrix <- data.matrix(saopaulo_industry)
heatmaply(normalize(saopaulo_industry_matrix),
          Colv = NA,
          dist_method = "euclidean",
          hclust_method = "ward.D",
          seriate = "OLO",
          colors = Blues,
          krow = 9,
          margins = c(NA, 200,60,NA),
          fontsize_row = 3,
          fontsize_col = 5,
          main = "Geo Segmentation of Industry Specializations in São Paulo Macrometropolis",
          xlab = "Industry Location Quotient",
          ylab = "Municipalities in São Paulo")

4.8 Mapping the clusters

cutree() function of stats package cuts the tree (dendogram), result of hclust function, into several groups by specifying the number of groups/clusters.

groups <- as.factor(cutree(hclust_ward, k =9))

Now, we need to join the groups to the saopaulo sf dataframe.

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

Now, we can use qtm() function of tmap package to quickly plot the 7 clusters of industry specializations in São Paulo Macrometropolis.

qtm(saopaulo_cluster, "CLUSTER")

We can see that the hierarchical clustering analysis plot is very fragmented, which is one limitation of non-spatially clustering analysis method.

5. Spatially Constrained Clustering - SKATER method

5.1 Computing Neighbour List

Before we use poly2nb() function to compute the neighbours list based on regions with contiguous boundaries, where default method to define contiguity is Queen’s method, we have to convert the saopaulo from sf dataframe into sp object, SpatialPolygonsDataFrame.

saopaulo_sp <- as_Spatial(saopaulo)
saopaulo.nb <- poly2nb(saopaulo_sp, queen = TRUE, snap = 0.02)
summary(saopaulo.nb)
## Neighbour list object:
## Number of regions: 172 
## Number of nonzero links: 974 
## Percentage nonzero weights: 3.29232 
## Average number of links: 5.662791 
## Link number distribution:
## 
##  1  2  3  4  5  6  7  8  9 10 12 13 27 
##  4  9 11 34 34 31 18 14  7  5  3  1  1 
## 4 least connected regions:
## 8 9 36 98 with 1 link
## 1 most connected region:
## 159 with 27 links

We can see that the number of average link is 5, the most connected municipality has 27 neighbours.

Let us plot the neighbour list.

plot(saopaulo_sp, border = grey(0.5))
plot(saopaulo.nb, coordinates(saopaulo_sp), col = "red", add = TRUE)

5.2 Computing weights list

Next, we will compute the cost of each edge using nbcosts() function of spdep package, the cost is the distance between each nodes.

lcosts <- nbcosts(saopaulo.nb, saopaulo_industry)

Basically, lcosts is the notion of a generalised weight for a spatial weights matrix.

Next, we will incorporate these spatial weights/costs into a weights object by converting the neighbour list to a list weights object.

We will use nb2listw() function of spdep package to do this and we specify the style as B (basic binary coding) to make sure the cost values are not row-standardised.

saopaulo.weights <- nb2listw(saopaulo.nb, lcosts, style = "B")
summary(saopaulo.weights)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 172 
## Number of nonzero links: 974 
## Percentage nonzero weights: 3.29232 
## Average number of links: 5.662791 
## Link number distribution:
## 
##  1  2  3  4  5  6  7  8  9 10 12 13 27 
##  4  9 11 34 34 31 18 14  7  5  3  1  1 
## 4 least connected regions:
## 8 9 36 98 with 1 link
## 1 most connected region:
## 159 with 27 links
## 
## Weights style: B 
## Weights constants summary:
##     n    nn       S0      S1      S2
## B 172 29584 14682.63 1053909 9140517

5.3 Computing Minimum Spanning Tree

We compute the minimum spanning tree by using mstree() function of spdep package.

saopaulo.mst <- mstree(saopaulo.weights)
dim(saopaulo.mst)
## [1] 171   3

The dimension is 171 and not the total numer of rows, 172, because minimum spanning tree consists of n-1 edges/links to traverse all the nodes.

plot(saopaulo_sp, border = gray(0.5))
plot.mst(saopaulo.mst, coordinates(saopaulo_sp), col = "blue", cex.lab = 0.7, cex.circles = 0.005, add = TRUE)

5.4 Computing SKATER spatially constrained clusters

To compute the spatially constrained cluster, we use skater() function of spdep package which takes in 3 mandatory arguments:

  • first two columns of the minimum spanning tree matrix

  • the data matrix to be updated

  • number of cuts (one less than the number of clusters)

clust9 <- skater(saopaulo.mst[,1:2], saopaulo_industry, method = "euclidean", 8)
str(clust9)
## List of 8
##  $ groups      : num [1:172] 1 1 1 1 1 1 1 9 6 1 ...
##  $ edges.groups:List of 9
##   ..$ :List of 3
##   .. ..$ node: num [1:113] 23 168 55 24 51 53 165 170 1 163 ...
##   .. ..$ edge: num [1:112, 1:3] 168 24 163 170 165 1 165 83 11 144 ...
##   .. ..$ ssw : num 761
##   ..$ :List of 3
##   .. ..$ node: num [1:6] 116 95 118 101 88 105
##   .. ..$ edge: num [1:5, 1:3] 95 95 118 116 118 116 118 101 88 105 ...
##   .. ..$ ssw : num 71.5
##   ..$ :List of 3
##   .. ..$ node: num 87
##   .. ..$ edge: num[0 , 1:3] 
##   .. ..$ ssw : num 0
##   ..$ :List of 3
##   .. ..$ node: num 102
##   .. ..$ edge: num[0 , 1:3] 
##   .. ..$ ssw : num 0
##   ..$ :List of 3
##   .. ..$ node: num [1:15] 82 19 68 64 63 73 70 79 58 65 ...
##   .. ..$ edge: num [1:14, 1:3] 19 73 63 63 73 68 19 64 68 63 ...
##   .. ..$ ssw : num 257
##   ..$ :List of 3
##   .. ..$ node: num [1:2] 15 9
##   .. ..$ edge: num [1, 1:3] 15 9 3.87
##   .. ..$ ssw : num 3.87
##   ..$ :List of 3
##   .. ..$ node: num [1:28] 113 99 121 90 106 152 103 117 89 120 ...
##   .. ..$ edge: num [1:27, 1:3] 121 90 121 106 120 90 114 100 113 152 ...
##   .. ..$ ssw : num 443
##   ..$ :List of 3
##   .. ..$ node: num 86
##   .. ..$ edge: num[0 , 1:3] 
##   .. ..$ ssw : num 0
##   ..$ :List of 3
##   .. ..$ node: num [1:5] 30 17 12 29 8
##   .. ..$ edge: num [1:4, 1:3] 30 30 30 30 17 ...
##   .. ..$ ssw : num 74.5
##  $ not.prune   : NULL
##  $ candidates  : int [1:9] 1 2 3 4 5 6 7 8 9
##  $ ssto        : num 2624
##  $ ssw         : num [1:9] 2624 2370 2213 2089 1965 ...
##  $ crit        : num [1:2] 1 Inf
##  $ vec.crit    : num [1:172] 1 1 1 1 1 1 1 1 1 1 ...
##  - attr(*, "class")= chr "skater"

The groups frequency:

table(clust9$groups)
## 
##   1   2   3   4   5   6   7   8   9 
## 113   6   1   1  15   2  28   1   5
plot(saopaulo_sp, border=gray(.5))
plot(clust9, coordinates(saopaulo_sp), cex.lab=.7,
     groups.colors=c("red","green","purple", "yellow", "blue", "brown", "pink"), cex.circles=0.005, add=TRUE)

5.5 Visualizing SKATER spatially constrained clusters

groups_mat <- as.matrix(clust9$groups)
saopaolu_spatialcluster <- cbind(saopaulo_cluster, as.factor(groups_mat)) %>%
  rename(`SP_CLUSTER`=`as.factor.groups_mat.`)
qtm(saopaolu_spatialcluster, "SP_CLUSTER")

Finally, the clusters are not fragmented and we can see that Cluster 1 covers big area, 113 municipalities in exact while there are 3 clusters who only contains 1 municipality, indicating that the cluster have an industry specialization. Let’s see the summary of the Location Quotient of industries in each cluster.

cluster1 <- saopaolu_spatialcluster %>%
  filter(SP_CLUSTER == 1) %>%
  select(contains("LQ_"))

summary(cluster1)
##  LQ_AGRI_INDUSTRY  LQ_EXTRACTIVE_INDUSTRY LQ_TRANSFORM_INDUSTRY
##  Min.   : 0.0000   Min.   : 0.0000        Min.   :0.2110       
##  1st Qu.: 0.1826   1st Qu.: 0.0000        1st Qu.:0.8944       
##  Median : 0.7866   Median : 0.7365        Median :1.3120       
##  Mean   : 2.6753   Mean   : 2.7391        Mean   :1.3754       
##  3rd Qu.: 2.3497   3rd Qu.: 2.4975        3rd Qu.:1.7789       
##  Max.   :60.9939   Max.   :26.1729        Max.   :3.2620       
##  LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY LQ_CONSTRUCTION_INDUSTRY
##  Min.   :0.0000     Min.   : 0.0000   Min.   :0.1355          
##  1st Qu.:0.0000     1st Qu.: 0.9589   1st Qu.:0.8170          
##  Median :0.0000     Median : 1.3603   Median :1.0092          
##  Mean   :0.4494     Mean   : 1.6365   Mean   :1.0310          
##  3rd Qu.:0.1841     3rd Qu.: 1.9824   3rd Qu.:1.1938          
##  Max.   :8.6511     Max.   :11.3510   Max.   :1.9899          
##  LQ_TRADE_REPAIR_INDUSTRY LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
##  Min.   :0.3032           Min.   :0.1743        Min.   :0.3086         
##  1st Qu.:1.0755           1st Qu.:0.8370        1st Qu.:0.9463         
##  Median :1.1647           Median :1.0451        Median :1.0471         
##  Mean   :1.1668           Mean   :1.2307        Mean   :1.1552         
##  3rd Qu.:1.2860           3rd Qu.:1.5293        3rd Qu.:1.2421         
##  Max.   :1.6397           Max.   :3.4181        Max.   :4.5032         
##  LQ_ICT_INDUSTRY  LQ_FINANCIAL_INDUSTRY LQ_REALESTATE_INDUSTRY
##  Min.   :0.0000   Min.   :0.0000        Min.   :0.0000        
##  1st Qu.:0.2734   1st Qu.:0.2535        1st Qu.:0.4535        
##  Median :0.3611   Median :0.3847        Median :0.6776        
##  Mean   :0.5579   Mean   :0.4403        Mean   :0.7012        
##  3rd Qu.:0.5590   3rd Qu.:0.5534        3rd Qu.:0.9251        
##  Max.   :8.0422   Max.   :2.1781        Max.   :1.8481        
##  LQ_PROF_TECHNICAL_INDUSTRY LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY
##  Min.   :0.0000             Min.   :0.0882    Min.   : 0.2823   
##  1st Qu.:0.4019             1st Qu.:0.4659    1st Qu.: 0.9902   
##  Median :0.5272             Median :0.6063    Median : 2.3539   
##  Mean   :0.5960             Mean   :0.7052    Mean   : 3.6170   
##  3rd Qu.:0.6944             3rd Qu.:0.7732    3rd Qu.: 4.4035   
##  Max.   :2.4735             Max.   :2.6437    Max.   :35.5707   
##  LQ_EDUCATION_INDUSTRY LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
##  Min.   :0.0000        Min.   :0.0000         Min.   :0.0000             
##  1st Qu.:0.8443        1st Qu.:0.4577         1st Qu.:0.7766             
##  Median :1.0378        Median :0.6029         Median :0.9449             
##  Mean   :1.0652        Mean   :0.6405         Mean   :0.9534             
##  3rd Qu.:1.3303        3rd Qu.:0.7792         3rd Qu.:1.1544             
##  Max.   :2.1971        Max.   :1.7038         Max.   :1.9038             
##  LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY             geom    
##  Min.   :0.3551             Min.   :0.00000   MULTIPOLYGON :113  
##  1st Qu.:0.7704             1st Qu.:0.00000   epsg:4674    :  0  
##  Median :0.9388             Median :0.00000   +proj=long...:  0  
##  Mean   :0.9637             Mean   :0.06302                      
##  3rd Qu.:1.1262             3rd Qu.:0.00000                      
##  Max.   :2.3990             Max.   :4.33767

Cluster 1 covers the entire central, north area and bottom of the east area of São Paulo Macrometropolis.

From the LQ, Cluster 1 seems to specialize in agriculture industry, with quite many extractive industry companies and public administration industries as well. Cluster 1 also seems to have a growing ICT sector and growing water supply and treatment industries.

cluster2 <- saopaolu_spatialcluster %>%
  filter(SP_CLUSTER == 2) %>%
  select(contains("LQ_"))

summary(cluster2)
##  LQ_AGRI_INDUSTRY LQ_EXTRACTIVE_INDUSTRY LQ_TRANSFORM_INDUSTRY
##  Min.   :35.43    Min.   :0.000          Min.   :0.2045       
##  1st Qu.:39.94    1st Qu.:0.000          1st Qu.:0.2399       
##  Median :49.69    Median :2.268          Median :0.2570       
##  Mean   :48.61    Mean   :2.366          Mean   :0.3234       
##  3rd Qu.:54.90    3rd Qu.:4.568          3rd Qu.:0.3779       
##  Max.   :63.50    Max.   :5.083          Max.   :0.5694       
##  LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY LQ_CONSTRUCTION_INDUSTRY
##  Min.   :0          Min.   :0.0000    Min.   :0.1432          
##  1st Qu.:0          1st Qu.:0.0000    1st Qu.:0.2286          
##  Median :0          Median :0.0000    Median :0.2908          
##  Mean   :0          Mean   :0.2234    Mean   :0.2925          
##  3rd Qu.:0          3rd Qu.:0.0000    3rd Qu.:0.3715          
##  Max.   :0          Max.   :1.3407    Max.   :0.4240          
##  LQ_TRADE_REPAIR_INDUSTRY LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
##  Min.   :0.2461           Min.   :0.1985        Min.   :0.2893         
##  1st Qu.:0.3712           1st Qu.:0.2663        1st Qu.:0.4114         
##  Median :0.5574           Median :0.3514        Median :0.7739         
##  Mean   :0.5410           Mean   :0.3816        Mean   :0.8059         
##  3rd Qu.:0.7187           3rd Qu.:0.5096        3rd Qu.:1.2168         
##  Max.   :0.8036           Max.   :0.5881        Max.   :1.3430         
##  LQ_ICT_INDUSTRY   LQ_FINANCIAL_INDUSTRY LQ_REALESTATE_INDUSTRY
##  Min.   :0.00000   Min.   :0.00000       Min.   :0.00000       
##  1st Qu.:0.02732   1st Qu.:0.00000       1st Qu.:0.02558       
##  Median :0.06714   Median :0.01964       Median :0.10998       
##  Mean   :0.09178   Mean   :0.09834       Mean   :0.15994       
##  3rd Qu.:0.09092   3rd Qu.:0.20610       3rd Qu.:0.18685       
##  Max.   :0.30353   Max.   :0.28902       Max.   :0.52976       
##  LQ_PROF_TECHNICAL_INDUSTRY LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY
##  Min.   :0.0625             Min.   :0.09233   Min.   : 3.613    
##  1st Qu.:0.1916             1st Qu.:0.10876   1st Qu.: 4.665    
##  Median :0.2174             Median :0.13431   Median : 7.403    
##  Mean   :0.2013             Mean   :0.13810   Mean   : 9.741    
##  3rd Qu.:0.2346             3rd Qu.:0.15485   3rd Qu.: 8.176    
##  Max.   :0.2874             Max.   :0.20570   Max.   :27.838    
##  LQ_EDUCATION_INDUSTRY LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
##  Min.   :0.07338       Min.   :0.06187        Min.   :0.1851             
##  1st Qu.:0.14435       1st Qu.:0.13075        1st Qu.:0.2110             
##  Median :0.32081       Median :0.18894        Median :0.3289             
##  Mean   :0.45260       Mean   :0.20851        Mean   :0.4781             
##  3rd Qu.:0.49472       3rd Qu.:0.25109        3rd Qu.:0.4150             
##  Max.   :1.36240       Max.   :0.42818        Max.   :1.4099             
##  LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY            geom  
##  Min.   :0.1479             Min.   :0        MULTIPOLYGON :6  
##  1st Qu.:0.3205             1st Qu.:0        epsg:4674    :0  
##  Median :0.3536             Median :0        +proj=long...:0  
##  Mean   :0.4067             Mean   :0                         
##  3rd Qu.:0.4764             3rd Qu.:0                         
##  Max.   :0.7585             Max.   :0

Cluster 2 covers the east area of São Paulo Macrometropolis. Cluster 2 is another cluster that’s specialized in agriculture with decent LQ for public administration industry as well.

cluster3 <- saopaolu_spatialcluster %>%
  filter(SP_CLUSTER == 3) %>%
  select(contains("LQ_"))

summary(cluster3)
##  LQ_AGRI_INDUSTRY LQ_EXTRACTIVE_INDUSTRY LQ_TRANSFORM_INDUSTRY
##  Min.   :3.334    Min.   :0              Min.   :0.3067       
##  1st Qu.:3.334    1st Qu.:0              1st Qu.:0.3067       
##  Median :3.334    Median :0              Median :0.3067       
##  Mean   :3.334    Mean   :0              Mean   :0.3067       
##  3rd Qu.:3.334    3rd Qu.:0              3rd Qu.:0.3067       
##  Max.   :3.334    Max.   :0              Max.   :0.3067       
##  LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY LQ_CONSTRUCTION_INDUSTRY
##  Min.   :0          Min.   :0         Min.   :0.4296          
##  1st Qu.:0          1st Qu.:0         1st Qu.:0.4296          
##  Median :0          Median :0         Median :0.4296          
##  Mean   :0          Mean   :0         Mean   :0.4296          
##  3rd Qu.:0          3rd Qu.:0         3rd Qu.:0.4296          
##  Max.   :0          Max.   :0         Max.   :0.4296          
##  LQ_TRADE_REPAIR_INDUSTRY LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
##  Min.   :1.573            Min.   :0.4857        Min.   :2.3            
##  1st Qu.:1.573            1st Qu.:0.4857        1st Qu.:2.3            
##  Median :1.573            Median :0.4857        Median :2.3            
##  Mean   :1.573            Mean   :0.4857        Mean   :2.3            
##  3rd Qu.:1.573            3rd Qu.:0.4857        3rd Qu.:2.3            
##  Max.   :1.573            Max.   :0.4857        Max.   :2.3            
##  LQ_ICT_INDUSTRY LQ_FINANCIAL_INDUSTRY LQ_REALESTATE_INDUSTRY
##  Min.   :0       Min.   :0             Min.   :0             
##  1st Qu.:0       1st Qu.:0             1st Qu.:0             
##  Median :0       Median :0             Median :0             
##  Mean   :0       Mean   :0             Mean   :0             
##  3rd Qu.:0       3rd Qu.:0             3rd Qu.:0             
##  Max.   :0       Max.   :0             Max.   :0             
##  LQ_PROF_TECHNICAL_INDUSTRY LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY
##  Min.   :0.2912             Min.   :0.3355    Min.   :136.2     
##  1st Qu.:0.2912             1st Qu.:0.3355    1st Qu.:136.2     
##  Median :0.2912             Median :0.3355    Median :136.2     
##  Mean   :0.2912             Mean   :0.3355    Mean   :136.2     
##  3rd Qu.:0.2912             3rd Qu.:0.3355    3rd Qu.:136.2     
##  Max.   :0.2912             Max.   :0.3355    Max.   :136.2     
##  LQ_EDUCATION_INDUSTRY LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
##  Min.   :0.6667        Min.   :1.153          Min.   :0                  
##  1st Qu.:0.6667        1st Qu.:1.153          1st Qu.:0                  
##  Median :0.6667        Median :1.153          Median :0                  
##  Mean   :0.6667        Mean   :1.153          Mean   :0                  
##  3rd Qu.:0.6667        3rd Qu.:1.153          3rd Qu.:0                  
##  Max.   :0.6667        Max.   :1.153          Max.   :0                  
##  LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY            geom  
##  Min.   :0.4594             Min.   :0        MULTIPOLYGON :1  
##  1st Qu.:0.4594             1st Qu.:0        epsg:4674    :0  
##  Median :0.4594             Median :0        +proj=long...:0  
##  Mean   :0.4594             Mean   :0                         
##  3rd Qu.:0.4594             3rd Qu.:0                         
##  Max.   :0.4594             Max.   :0

Cluster 3 is a single municipality cluster, located on top of cluster 2, covers the east area of São Paulo Macrometropolis.

We can see that it’s LQ for Public administration industry is very high, indicating that it’s specialized in public administration, defense and social security, probably where the police offices and government offices are located.

cluster4 <- saopaolu_spatialcluster %>%
  filter(SP_CLUSTER == 4) %>%
  select(contains("LQ_"))

summary(cluster4)
##  LQ_AGRI_INDUSTRY LQ_EXTRACTIVE_INDUSTRY LQ_TRANSFORM_INDUSTRY
##  Min.   :19.59    Min.   :92.23          Min.   :0.6864       
##  1st Qu.:19.59    1st Qu.:92.23          1st Qu.:0.6864       
##  Median :19.59    Median :92.23          Median :0.6864       
##  Mean   :19.59    Mean   :92.23          Mean   :0.6864       
##  3rd Qu.:19.59    3rd Qu.:92.23          3rd Qu.:0.6864       
##  Max.   :19.59    Max.   :92.23          Max.   :0.6864       
##  LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY LQ_CONSTRUCTION_INDUSTRY
##  Min.   :0          Min.   :0         Min.   :0.2404          
##  1st Qu.:0          1st Qu.:0         1st Qu.:0.2404          
##  Median :0          Median :0         Median :0.2404          
##  Mean   :0          Mean   :0         Mean   :0.2404          
##  3rd Qu.:0          3rd Qu.:0         3rd Qu.:0.2404          
##  Max.   :0          Max.   :0         Max.   :0.2404          
##  LQ_TRADE_REPAIR_INDUSTRY LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
##  Min.   :0.9534           Min.   :0.2718        Min.   :1.471          
##  1st Qu.:0.9534           1st Qu.:0.2718        1st Qu.:1.471          
##  Median :0.9534           Median :0.2718        Median :1.471          
##  Mean   :0.9534           Mean   :0.2718        Mean   :1.471          
##  3rd Qu.:0.9534           3rd Qu.:0.2718        3rd Qu.:1.471          
##  Max.   :0.9534           Max.   :0.2718        Max.   :1.471          
##  LQ_ICT_INDUSTRY  LQ_FINANCIAL_INDUSTRY LQ_REALESTATE_INDUSTRY
##  Min.   :0.2295   Min.   :0.7914        Min.   :0             
##  1st Qu.:0.2295   1st Qu.:0.7914        1st Qu.:0             
##  Median :0.2295   Median :0.7914        Median :0             
##  Mean   :0.2295   Mean   :0.7914        Mean   :0             
##  3rd Qu.:0.2295   3rd Qu.:0.7914        3rd Qu.:0             
##  Max.   :0.2295   Max.   :0.7914        Max.   :0             
##  LQ_PROF_TECHNICAL_INDUSTRY LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY
##  Min.   :0.1629             Min.   :0.1877    Min.   :38.11     
##  1st Qu.:0.1629             1st Qu.:0.1877    1st Qu.:38.11     
##  Median :0.1629             Median :0.1877    Median :38.11     
##  Mean   :0.1629             Mean   :0.1877    Mean   :38.11     
##  3rd Qu.:0.1629             3rd Qu.:0.1877    3rd Qu.:38.11     
##  Max.   :0.1629             Max.   :0.1877    Max.   :38.11     
##  LQ_EDUCATION_INDUSTRY LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
##  Min.   :1.119         Min.   :0.9678         Min.   :0.9651             
##  1st Qu.:1.119         1st Qu.:0.9678         1st Qu.:0.9651             
##  Median :1.119         Median :0.9678         Median :0.9651             
##  Mean   :1.119         Mean   :0.9678         Mean   :0.9651             
##  3rd Qu.:1.119         3rd Qu.:0.9678         3rd Qu.:0.9651             
##  Max.   :1.119         Max.   :0.9678         Max.   :0.9651             
##  LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY            geom  
##  Min.   :1.028              Min.   :0        MULTIPOLYGON :1  
##  1st Qu.:1.028              1st Qu.:0        epsg:4674    :0  
##  Median :1.028              Median :0        +proj=long...:0  
##  Mean   :1.028              Mean   :0                         
##  3rd Qu.:1.028              3rd Qu.:0                         
##  Max.   :1.028              Max.   :0

Cluster 4 is another single municipality cluster, located to the left of cluster 2, covers the east area of São Paulo Macrometropolis.

We can see that it’s LQ for extractive industry is very high, indicating that it’s specialized in extractive industry, probably where the mining for minerals, drilling and pumping for oil and other activities take place.

cluster5 <- saopaolu_spatialcluster %>%
  filter(SP_CLUSTER == 5) %>%
  select(contains("LQ_"))

summary(cluster5)
##  LQ_AGRI_INDUSTRY LQ_EXTRACTIVE_INDUSTRY LQ_TRANSFORM_INDUSTRY
##  Min.   : 3.021   Min.   : 0.000         Min.   :0.5976       
##  1st Qu.: 8.723   1st Qu.: 2.160         1st Qu.:0.7131       
##  Median :18.573   Median : 2.940         Median :0.8490       
##  Mean   :18.617   Mean   : 9.067         Mean   :1.1560       
##  3rd Qu.:25.101   3rd Qu.:13.059         3rd Qu.:1.1916       
##  Max.   :38.037   Max.   :34.897         Max.   :3.6360       
##  LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY LQ_CONSTRUCTION_INDUSTRY
##  Min.   :0.0000     Min.   :0.0000    Min.   :0.2109          
##  1st Qu.:0.0000     1st Qu.:0.3192    1st Qu.:0.5078          
##  Median :0.0000     Median :0.9792    Median :0.7277          
##  Mean   :0.5271     Mean   :1.2230    Mean   :0.7440          
##  3rd Qu.:0.0000     3rd Qu.:1.2372    3rd Qu.:0.9348          
##  Max.   :7.0506     Max.   :6.9496    Max.   :1.4058          
##  LQ_TRADE_REPAIR_INDUSTRY LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
##  Min.   :0.5273           Min.   :0.4084        Min.   :0.5969         
##  1st Qu.:0.8575           1st Qu.:0.5161        1st Qu.:0.7999         
##  Median :1.0685           Median :0.7704        Median :0.9671         
##  Mean   :1.0736           Mean   :0.8486        Mean   :1.0481         
##  3rd Qu.:1.1935           3rd Qu.:1.1609        3rd Qu.:1.0882         
##  Max.   :1.6942           Max.   :1.4322        Max.   :2.3113         
##  LQ_ICT_INDUSTRY  LQ_FINANCIAL_INDUSTRY LQ_REALESTATE_INDUSTRY
##  Min.   :0.0000   Min.   :0.0000        Min.   :0.0000        
##  1st Qu.:0.1220   1st Qu.:0.1978        1st Qu.:0.2667        
##  Median :0.2168   Median :0.3623        Median :0.3049        
##  Mean   :0.1846   Mean   :0.3637        Mean   :0.4104        
##  3rd Qu.:0.2581   3rd Qu.:0.4440        3rd Qu.:0.5528        
##  Max.   :0.3607   Max.   :0.8350        Max.   :0.9814        
##  LQ_PROF_TECHNICAL_INDUSTRY LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY
##  Min.   :0.0000             Min.   :0.09801   Min.   : 1.458    
##  1st Qu.:0.2003             1st Qu.:0.19879   1st Qu.: 2.323    
##  Median :0.3328             Median :0.21626   Median : 4.002    
##  Mean   :0.3049             Mean   :0.27571   Mean   : 8.931    
##  3rd Qu.:0.3806             3rd Qu.:0.33296   3rd Qu.: 7.243    
##  Max.   :0.5343             Max.   :0.56831   Max.   :43.262    
##  LQ_EDUCATION_INDUSTRY LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
##  Min.   :0.2823        Min.   :0.0000         Min.   :0.0000             
##  1st Qu.:0.5154        1st Qu.:0.2043         1st Qu.:0.5597             
##  Median :0.8278        Median :0.5518         Median :0.6842             
##  Mean   :0.8722        Mean   :0.4674         Mean   :0.6518             
##  3rd Qu.:1.1673        3rd Qu.:0.6340         3rd Qu.:0.8454             
##  Max.   :1.7053        Max.   :1.1121         Max.   :1.1155             
##  LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY            geom   
##  Min.   :0.5011             Min.   :0        MULTIPOLYGON :15  
##  1st Qu.:0.6142             1st Qu.:0        epsg:4674    : 0  
##  Median :0.7383             Median :0        +proj=long...: 0  
##  Mean   :0.8395             Mean   :0                          
##  3rd Qu.:0.8986             3rd Qu.:0                          
##  Max.   :1.7625             Max.   :0

Cluster 5 totally cover the entire west region of São Paulo Macrometropolis. It is quite big in area.

Looking at the LQ, cluster 5 is quite specialized in public administration industry, agriculture industry and extractive industry, although not as quite as cluster 4 for extractive industry and cluster 3 for public administration industry.

cluster6 <- saopaolu_spatialcluster %>%
  filter(SP_CLUSTER == 6) %>%
  select(contains("LQ_"))

summary(cluster6)
##  LQ_AGRI_INDUSTRY LQ_EXTRACTIVE_INDUSTRY LQ_TRANSFORM_INDUSTRY
##  Min.   :17.41    Min.   :35.87          Min.   :0.7118       
##  1st Qu.:17.49    1st Qu.:36.04          1st Qu.:0.9418       
##  Median :17.57    Median :36.20          Median :1.1718       
##  Mean   :17.57    Mean   :36.20          Mean   :1.1718       
##  3rd Qu.:17.66    3rd Qu.:36.37          3rd Qu.:1.4018       
##  Max.   :17.74    Max.   :36.54          Max.   :1.6318       
##  LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY LQ_CONSTRUCTION_INDUSTRY
##  Min.   :0          Min.   :0.0000    Min.   :0.2540          
##  1st Qu.:0          1st Qu.:0.8031    1st Qu.:0.3775          
##  Median :0          Median :1.6063    Median :0.5009          
##  Mean   :0          Mean   :1.6063    Mean   :0.5009          
##  3rd Qu.:0          3rd Qu.:2.4094    3rd Qu.:0.6244          
##  Max.   :0          Max.   :3.2125    Max.   :0.7479          
##  LQ_TRADE_REPAIR_INDUSTRY LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
##  Min.   :0.7416           Min.   :3.446         Min.   :1.263          
##  1st Qu.:0.7596           1st Qu.:3.500         1st Qu.:1.424          
##  Median :0.7776           Median :3.555         Median :1.585          
##  Mean   :0.7776           Mean   :3.555         Mean   :1.585          
##  3rd Qu.:0.7956           3rd Qu.:3.609         3rd Qu.:1.746          
##  Max.   :0.8137           Max.   :3.664         Max.   :1.907          
##  LQ_ICT_INDUSTRY   LQ_FINANCIAL_INDUSTRY LQ_REALESTATE_INDUSTRY
##  Min.   :0.00000   Min.   :0.0000        Min.   :0.0000        
##  1st Qu.:0.08923   1st Qu.:0.2090        1st Qu.:0.2767        
##  Median :0.17847   Median :0.4181        Median :0.5533        
##  Mean   :0.17847   Mean   :0.4181        Mean   :0.5533        
##  3rd Qu.:0.26770   3rd Qu.:0.6271        3rd Qu.:0.8300        
##  Max.   :0.35693   Max.   :0.8362        Max.   :1.1066        
##  LQ_PROF_TECHNICAL_INDUSTRY LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY
##  Min.   :0.1722             Min.   :0.1947    Min.   :19.76     
##  1st Qu.:0.2559             1st Qu.:0.2204    1st Qu.:19.85     
##  Median :0.3395             Median :0.2461    Median :19.95     
##  Mean   :0.3395             Mean   :0.2461    Mean   :19.95     
##  3rd Qu.:0.4232             3rd Qu.:0.2718    3rd Qu.:20.04     
##  Max.   :0.5069             Max.   :0.2976    Max.   :20.13     
##  LQ_EDUCATION_INDUSTRY LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
##  Min.   :0.00000       Min.   :0.00000        Min.   :0                  
##  1st Qu.:0.04927       1st Qu.:0.08363        1st Qu.:0                  
##  Median :0.09854       Median :0.16727        Median :0                  
##  Mean   :0.09854       Mean   :0.16727        Mean   :0                  
##  3rd Qu.:0.14781       3rd Qu.:0.25090        3rd Qu.:0                  
##  Max.   :0.19708       Max.   :0.33454        Max.   :0                  
##  LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY            geom  
##  Min.   :0.3998             Min.   :0        MULTIPOLYGON :2  
##  1st Qu.:0.4696             1st Qu.:0        epsg:4674    :0  
##  Median :0.5394             Median :0        +proj=long...:0  
##  Mean   :0.5394             Mean   :0                         
##  3rd Qu.:0.6092             3rd Qu.:0                         
##  Max.   :0.6790             Max.   :0

Cluster 6 is a two municipality cluster located at the top most northern area of São Paulo Macrometropolis.

cluster7 <- saopaolu_spatialcluster %>%
  filter(SP_CLUSTER == 7) %>%
  select(contains("LQ_"))

summary(cluster7)
##  LQ_AGRI_INDUSTRY  LQ_EXTRACTIVE_INDUSTRY LQ_TRANSFORM_INDUSTRY
##  Min.   : 0.3332   Min.   : 0.0000        Min.   :0.3242       
##  1st Qu.: 1.5473   1st Qu.: 0.7559        1st Qu.:0.6301       
##  Median : 2.8782   Median : 4.9575        Median :0.8780       
##  Mean   : 6.6818   Mean   : 9.6251        Mean   :0.9585       
##  3rd Qu.:10.1813   3rd Qu.:10.5828        3rd Qu.:1.1624       
##  Max.   :29.3796   Max.   :47.2389        Max.   :2.2960       
##  LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY LQ_CONSTRUCTION_INDUSTRY
##  Min.   :0.0000     Min.   : 0.0000   Min.   :0.0000          
##  1st Qu.:0.0000     1st Qu.: 0.0000   1st Qu.:0.4956          
##  Median :0.0000     Median : 0.5477   Median :0.7579          
##  Mean   :0.3867     Mean   : 1.4639   Mean   :0.7765          
##  3rd Qu.:0.0000     3rd Qu.: 1.4439   3rd Qu.:1.0790          
##  Max.   :6.1577     Max.   :13.5609   Max.   :1.4423          
##  LQ_TRADE_REPAIR_INDUSTRY LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
##  Min.   :0.5134           Min.   :0.0000        Min.   :0.7595         
##  1st Qu.:1.1050           1st Qu.:0.6850        1st Qu.:1.0955         
##  Median :1.2074           Median :0.8498        Median :1.2882         
##  Mean   :1.2520           Mean   :1.0604        Mean   :1.5614         
##  3rd Qu.:1.4030           3rd Qu.:1.2146        3rd Qu.:1.7269         
##  Max.   :2.1525           Max.   :3.1809        Max.   :3.5927         
##  LQ_ICT_INDUSTRY  LQ_FINANCIAL_INDUSTRY LQ_REALESTATE_INDUSTRY
##  Min.   :0.0000   Min.   :0.0000        Min.   :0.0000        
##  1st Qu.:0.1870   1st Qu.:0.0000        1st Qu.:0.0963        
##  Median :0.2776   Median :0.2284        Median :0.3429        
##  Mean   :0.3041   Mean   :0.2117        Mean   :0.3954        
##  3rd Qu.:0.3845   3rd Qu.:0.3356        3rd Qu.:0.6816        
##  Max.   :0.8351   Max.   :0.6358        Max.   :1.0799        
##  LQ_PROF_TECHNICAL_INDUSTRY LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY
##  Min.   :0.0000             Min.   :0.09134   Min.   : 0.4593   
##  1st Qu.:0.3090             1st Qu.:0.23622   1st Qu.: 1.6058   
##  Median :0.5070             Median :0.41050   Median : 9.7160   
##  Mean   :0.5056             Mean   :0.44635   Mean   :10.6088   
##  3rd Qu.:0.6707             3rd Qu.:0.58642   3rd Qu.:15.1702   
##  Max.   :1.0838             Max.   :0.99811   Max.   :38.5706   
##  LQ_EDUCATION_INDUSTRY LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
##  Min.   :0.2568        Min.   :0.0000         Min.   :0.0000             
##  1st Qu.:0.5686        1st Qu.:0.2496         1st Qu.:0.8696             
##  Median :1.0798        Median :0.6020         Median :0.9934             
##  Mean   :0.9985        Mean   :0.7184         Mean   :0.9654             
##  3rd Qu.:1.4216        3rd Qu.:1.1292         3rd Qu.:1.2027             
##  Max.   :1.9195        Max.   :1.8189         Max.   :1.8083             
##  LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY             geom   
##  Min.   :0.2999             Min.   :0.00000   MULTIPOLYGON :28  
##  1st Qu.:0.7611             1st Qu.:0.00000   epsg:4674    : 0  
##  Median :1.0388             Median :0.00000   +proj=long...: 0  
##  Mean   :1.0009             Mean   :0.02826                     
##  3rd Qu.:1.1329             3rd Qu.:0.00000                     
##  Max.   :1.9107             Max.   :0.79133

Cluster 7 is a relatively bigger municipality cluster located at the eastern side of São Paulo Macrometropolis.

Cluster 7, being a big area, is specialized in agriculture, extractive, public administration industries. Something new would be a growing energy industry and water supply and treatment industry.

cluster8 <- saopaolu_spatialcluster %>%
  filter(SP_CLUSTER == 8) %>%
  select(contains("LQ_"))

summary(cluster8)
##  LQ_AGRI_INDUSTRY LQ_EXTRACTIVE_INDUSTRY LQ_TRANSFORM_INDUSTRY
##  Min.   :31.87    Min.   :0              Min.   :0            
##  1st Qu.:31.87    1st Qu.:0              1st Qu.:0            
##  Median :31.87    Median :0              Median :0            
##  Mean   :31.87    Mean   :0              Mean   :0            
##  3rd Qu.:31.87    3rd Qu.:0              3rd Qu.:0            
##  Max.   :31.87    Max.   :0              Max.   :0            
##  LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY LQ_CONSTRUCTION_INDUSTRY
##  Min.   :47.8       Min.   :0         Min.   :0               
##  1st Qu.:47.8       1st Qu.:0         1st Qu.:0               
##  Median :47.8       Median :0         Median :0               
##  Mean   :47.8       Mean   :0         Mean   :0               
##  3rd Qu.:47.8       3rd Qu.:0         3rd Qu.:0               
##  Max.   :47.8       Max.   :0         Max.   :0               
##  LQ_TRADE_REPAIR_INDUSTRY LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
##  Min.   :1.096            Min.   :0.3869        Min.   :0.7853         
##  1st Qu.:1.096            1st Qu.:0.3869        1st Qu.:0.7853         
##  Median :1.096            Median :0.3869        Median :0.7853         
##  Mean   :1.096            Mean   :0.3869        Mean   :0.7853         
##  3rd Qu.:1.096            3rd Qu.:0.3869        3rd Qu.:0.7853         
##  Max.   :1.096            Max.   :0.3869        Max.   :0.7853         
##  LQ_ICT_INDUSTRY  LQ_FINANCIAL_INDUSTRY LQ_REALESTATE_INDUSTRY
##  Min.   :0.3267   Min.   :0             Min.   :0.7596        
##  1st Qu.:0.3267   1st Qu.:0             1st Qu.:0.7596        
##  Median :0.3267   Median :0             Median :0.7596        
##  Mean   :0.3267   Mean   :0             Mean   :0.7596        
##  3rd Qu.:0.3267   3rd Qu.:0             3rd Qu.:0.7596        
##  Max.   :0.3267   Max.   :0             Max.   :0.7596        
##  LQ_PROF_TECHNICAL_INDUSTRY LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY
##  Min.   :0.232              Min.   :0         Min.   :54.26     
##  1st Qu.:0.232              1st Qu.:0         1st Qu.:54.26     
##  Median :0.232              Median :0         Median :54.26     
##  Mean   :0.232              Mean   :0         Mean   :54.26     
##  3rd Qu.:0.232              3rd Qu.:0         3rd Qu.:54.26     
##  Max.   :0.232              Max.   :0         Max.   :54.26     
##  LQ_EDUCATION_INDUSTRY LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
##  Min.   :1.593         Min.   :0              Min.   :0                  
##  1st Qu.:1.593         1st Qu.:0              1st Qu.:0                  
##  Median :1.593         Median :0              Median :0                  
##  Mean   :1.593         Mean   :0              Mean   :0                  
##  3rd Qu.:1.593         3rd Qu.:0              3rd Qu.:0                  
##  Max.   :1.593         Max.   :0              Max.   :0                  
##  LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY            geom  
##  Min.   :0.3659             Min.   :0        MULTIPOLYGON :1  
##  1st Qu.:0.3659             1st Qu.:0        epsg:4674    :0  
##  Median :0.3659             Median :0        +proj=long...:0  
##  Mean   :0.3659             Mean   :0                         
##  3rd Qu.:0.3659             3rd Qu.:0                         
##  Max.   :0.3659             Max.   :0

Cluster 8 is another single municipality cluster, located to the right of cluster 2, covers the east area of São Paulo Macrometropolis, surrounded by cluster 2.

We can see that it’s LQ for energy and public administration industries are very high, this cluster definitely specializes in energy sector such as providing electricity and gas.

cluster9 <- saopaolu_spatialcluster %>%
  filter(SP_CLUSTER == 9) %>%
  select(contains("LQ_"))

summary(cluster9)
##  LQ_AGRI_INDUSTRY  LQ_EXTRACTIVE_INDUSTRY LQ_TRANSFORM_INDUSTRY
##  Min.   : 0.7757   Min.   : 9.588         Min.   :0.2854       
##  1st Qu.: 2.4237   1st Qu.:11.195         1st Qu.:0.9165       
##  Median : 6.3401   Median :17.170         Median :1.0726       
##  Mean   : 8.5756   Mean   :19.719         Mean   :1.1071       
##  3rd Qu.: 8.3346   3rd Qu.:19.433         3rd Qu.:1.1756       
##  Max.   :25.0039   Max.   :41.208         Max.   :2.0854       
##  LQ_ENERGY_INDUSTRY LQ_WATER_INDUSTRY LQ_CONSTRUCTION_INDUSTRY
##  Min.   :0          Min.   :0.000     Min.   :0.0000          
##  1st Qu.:0          1st Qu.:2.135     1st Qu.:0.5998          
##  Median :0          Median :2.174     Median :0.6086          
##  Mean   :0          Mean   :1.958     Mean   :0.5864          
##  3rd Qu.:0          3rd Qu.:2.529     3rd Qu.:0.6922          
##  Max.   :0          Max.   :2.953     Max.   :1.0311          
##  LQ_TRADE_REPAIR_INDUSTRY LQ_LOGISTICS_INDUSTRY LQ_ACCOMS_FOOD_INDUSTRY
##  Min.   :0.8356           Min.   :0.3390        Min.   :0.6249         
##  1st Qu.:0.9437           1st Qu.:0.9925        1st Qu.:0.7229         
##  Median :1.0880           Median :2.1371        Median :0.7667         
##  Mean   :1.1371           Mean   :1.9307        Mean   :1.3625         
##  3rd Qu.:1.3084           3rd Qu.:2.2261        3rd Qu.:1.6400         
##  Max.   :1.5097           Max.   :3.9586        Max.   :3.0582         
##  LQ_ICT_INDUSTRY   LQ_FINANCIAL_INDUSTRY LQ_REALESTATE_INDUSTRY
##  Min.   :0.08202   Min.   :0.0000        Min.   :0.2219        
##  1st Qu.:0.23922   1st Qu.:0.0000        1st Qu.:0.2384        
##  Median :0.33424   Median :0.2829        Median :0.2591        
##  Mean   :0.30065   Mean   :0.2280        Mean   :0.3707        
##  3rd Qu.:0.37066   3rd Qu.:0.3291        3rd Qu.:0.5621        
##  Max.   :0.47709   Max.   :0.5280        Max.   :0.5721        
##  LQ_PROF_TECHNICAL_INDUSTRY LQ_ADMIN_INDUSTRY LQ_PUBLIC_INDUSTRY
##  Min.   :0.3495             Min.   :0.1957    Min.   : 4.015    
##  1st Qu.:0.4611             1st Qu.:0.2013    1st Qu.: 5.676    
##  Median :0.6098             Median :0.5209    Median :13.623    
##  Mean   :0.7558             Mean   :0.4283    Mean   :11.533    
##  3rd Qu.:0.6180             3rd Qu.:0.5855    3rd Qu.:15.848    
##  Max.   :1.7406             Max.   :0.6381    Max.   :18.505    
##  LQ_EDUCATION_INDUSTRY LQ_HEALTHCARE_INDUSTRY LQ_ARTS_RECREATION_INDUSTRY
##  Min.   :0.4654        Min.   :0.1153         Min.   :0.8027             
##  1st Qu.:0.6667        1st Qu.:0.2402         1st Qu.:0.8625             
##  Median :0.7245        Median :0.3133         Median :0.9372             
##  Mean   :0.7514        Mean   :0.3411         Mean   :1.1083             
##  3rd Qu.:0.8000        3rd Qu.:0.4024         3rd Qu.:1.3799             
##  Max.   :1.1004        Max.   :0.6344         Max.   :1.5591             
##  LQ_OTHER_SERVICES_INDUSTRY LQ_INTL_INDUSTRY            geom  
##  Min.   :0.4275             Min.   :0        MULTIPOLYGON :5  
##  1st Qu.:0.4594             1st Qu.:0        epsg:4674    :0  
##  Median :0.7041             Median :0        +proj=long...:0  
##  Mean   :0.6701             Mean   :0                         
##  3rd Qu.:0.7488             3rd Qu.:0                         
##  Max.   :1.0106             Max.   :0

Lastly, cluster 9 is a mini cluster at the most north-west side of São Paulo Macrometropolis, surrounded by cluster 1.

Cluster 9 is again specialized in extractive industry, agriculture industry, public administration industry. It’s growing industry would be logistics and accomodation+food industries.

5.6 Conclusion

We can conclude that many of the clusters indicate industry specialization in agriculture, extractive and public administration industries, which indicates that São Paulo Macrometropolis is a developing region that relies heavily on it’s natural resources.

Other industry specializations such as services, logistics, ICT, financial, arts recreation are all in need of improvement.

Yet, priorities should still go to the development of education, financial, water, energy and healthcare industry specializations are these industries will provide the basic needs for the municipalities.