You are on page 1of 2

5.

Heatmap
heatmap_data <- Socio_Economic_and_Life_expectancy[, c("CO2",
"Communicable", "NonCommunicable", "Life Expectancy World Bank", "Health
Expenditure %")]

heatmap_data <- na.omit(heatmap_data)

correlation_matrix <- cor(heatmap_data)

row_labels <- c("CO2", "Communicable", "Non Communicable", "Life Expectancy",


"Health Expenditure %")
col_labels <- row_labels

heatmap(correlation_matrix,
Rowv = NA,
Colv = NA,
col = colorRampPalette(c("blue", "white", "red"))(100),
scale = "column",
margins = c(8, 5),
labRow = row_labels, # Row labels
labCol = col_labels, # Column labels
cexRow = 0.95, # Reduce the size of row labels
cexCol = 0.95) # Reduce the size of column labels
Hypothetical Analysis of Correlation Heatmap:
The correlation heatmap visualizes the relationship between CO2 emissions,
communicable diseases, non-communicable diseases, and life expectancy across
different countries. Each cell in the heatmap represents the correlation coefficient
between two variables.
As seen from the heatmap above, CO2 emissions, Non-communicable and
Communicable diseases have strong negative relationship with Life Expectancy,
showing that these factors impact greatly to human health. On the other hand,
Non communicable disease have no correalation to communicable disease or
have very little correlation.

You might also like