Using a step by step approach

Before starting the analysis for the Spatial-Statistics, a few important steps were taken in order to prepare the source data files. These steps are listed below:


Config Environment (step 1)

This step do an initial setup configuration for the project.


Data Ingestion (step 2)

The process of data ingestion — preparing data for analysis — usually includes steps called extract (taking the data from its current location), transform (cleansing and normalizing the data), and load (placing the data in a database where it can be analyzed).


Data Cleaning (step 3)

The objective of this step is analysing missing values and other strange conditions. In order to accomplish this task, a few R functions were used to quickly discover missing values, like NA and empty fields.

The command below was used to find out any NA values in each table.

There was no tables with NA values:

x
CODMUNI 0
ID 0
MUNIC 0
AREA 0
INDICE94 0
INDICE95 0
GINI_91 0
POP_94 0
POP_RUR 0
POP_URB 0
POP_FEM 0
POP_MAS 0
POP_TOT 0
URBLEVEL 0
PIB_PC 0
X_COORD 0
Y_COORD 0

Finally, the following command was used in each table to find out where empty values was hidden.

There was no tables with empty values:

x
CODMUNI.NA NA
ID.NA NA
MUNIC.NA NA
AREA.NA NA
INDICE94.NA NA
INDICE95.NA NA
GINI_91.NA NA
POP_94.NA NA
POP_RUR.NA NA
POP_URB.NA NA
POP_FEM.NA NA
POP_MAS.NA NA
POP_TOT.NA NA
URBLEVEL.NA NA
PIB_PC.NA NA
X_COORD.NA NA
Y_COORD.NA NA

For the exploration analysis report, we did not take any additional action, since the missing values was not relevant.

There are 33 cities in which the variables POP_RUR, POP_URB, POP_FEM, POP_MAS, POP_TOT have zero in their values, however the column POP_94 has value greater than zero. so, the strategy is to produce the value for the missing columns based on the average values for the rest of cities in Minas Gerais.

The following adjustments were taken:


Label Translation (step 4)

In order to make the data information more understandable, it was translated some relevant labels and domains from Czech to English.

For this project this step is not required.


Data Enhancement (step 5)

This step aims to improve the analysis by adding auxiliary information. Data enhancement is all about making sure any data that is coming into the business is being looked at with a critical eye and is being filtered down to maximize its value.

For this project this step is not required.


Data Preparation for the Spatial Statistics (step 6)

Selecting the target dataset

The below function was created to be used in the modeling exercises to be performed, the idea is to have a standard way to get the prepared data set already prepared with correct data types and dummies.