Question 1 The Chi-Squared test’s p-value being quite close to cero suggest that the Null Hipothesis of Complete Spatial Randomness (CSR) of the cholera deaths is rejected.
# Testing the randomnicity of the ccholera deaths
quadrat.test(deaths.qc)
##
## Chi-squared test of CSR using quadrat counts
## Pearson X2 statistic
##
## data:
## X2 = 1182.6, df = 24, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 25 tiles (irregular windows)
Question 2 Based on figure 2, we can say that at Sigma=50, we can surely suggest that one water pump is highly suspiciously located in a high intensity area.
Figure 2.1: An animated version of the 3D Estimated Intensity for Sigma=15
library(rgl)
deaths.kd15DF<-as.data.frame.im(deaths.kd15)
deaths.kd15DF<-deaths.kd15DF[order(deaths.kd15DF$x,deaths.kd15DF$y),]
breaks <- quantile(deaths.kd15DF$value, probs=seq(0,1,0.1),
na.rm = FALSE)
np <- findInterval(deaths.kd15DF$value, breaks, all.inside=TRUE)
colors <- heat.colors(10, alpha = 1)
bg3d(col="gray")
plot3d(x=deaths.kd15DF[,1],y=deaths.kd15DF[,2],z=deaths.kd15DF[,3],type = "l",col=colors[np], xlab = "x",ylab = "y",zlab = "Est. Intensity")
You must enable Javascript to view this page properly.
Figure 3: Exploring the different K Function plots varying the maximun distance parameter
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
## 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
## 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
## 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
## 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
## 91, 92, 93, 94, 95, 96, 97, 98, 99.
##
## Done.
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
## 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
## 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
## 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
## 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
## 91, 92, 93, 94, 95, 96, 97, 98, 99.
##
## Done.
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
## 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
## 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
## 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
## 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
## 91, 92, 93, 94, 95, 96, 97, 98, 99.
##
## Done.
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
## 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
## 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
## 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
## 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
## 91, 92, 93, 94, 95, 96, 97, 98, 99.
##
## Done.
This is a highly interesting and useful way to made public dcata that is collected every day in goverment agencies. I wish I had had more time to add or change more variables. Regarding the spatial concentration of homicides, an initial visual inspection would suggest that this events occur outside of the more garded and affluent areas like the loop and the northern Chicago neighborhoods. This last statement is consistent with the common knowledge of the spatial distribution of income and poverty in the city.
## [1] "CASE." "DATE..OF.OCCURRENCE"
## [3] "BLOCK" "IUCR"
## [5] "PRIMARY.DESCRIPTION" "SECONDARY.DESCRIPTION"
## [7] "LOCATION.DESCRIPTION" "ARREST"
## [9] "DOMESTIC" "BEAT"
## [11] "WARD" "FBI.CD"
## [13] "X.COORDINATE" "Y.COORDINATE"
## [15] "LATITUDE" "LONGITUDE"
## [17] "LOCATION"
## [1] 543 19
## [1] 517 19
##
## STREET AUTO HOUSE ALLEY APARTMENT
## 296 61 32 28 24
## PARK PROPERTY YARD PORCH PARKING LOT HALLWAY
## 13 13 11 7 5
## OGR data source with driver: GeoJSON
## Source: "/var/folders/2f/87llll5n63967bb_rp5xy1gr0000gn/T//RtmpTEgyvr/file112694b6c2f94", layer: "OGRGeoJSON"
## with 77 features
## It has 9 fields