if (FALSE) {
par(ask = TRUE)
# Creating an object of class prevR
col <- c(
id = "cluster",
x = "x",
y = "y",
n = "n",
pos = "pos",
c.type = "residence",
wn = "weighted.n",
wpos = "weighted.pos"
)
dhs <- as.prevR(fdhs.clusters, col, fdhs.boundary)
str(dhs)
print(dhs)
plot(dhs, main = "Clusters position")
plot(dhs, type = "c.type", main = "Clusters by residence")
plot(dhs, type = "count", main = "Observations by cluster")
plot(dhs, type = "flower", main = "Positive cases by cluster")
# Changing coordinates projection
plot(dhs, axes = TRUE)
dhs <- changeproj(
dhs,
"+proj=utm +zone=30 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
)
print(dhs)
plot(dhs, axes = TRUE)
# Calculating rings of equal number of observations for different values of N
dhs <- rings(dhs, N = c(100, 200, 300, 400, 500))
print(dhs)
summary(dhs)
# Prevalence surface for N=300
prev.N300 <- kde(dhs, N = 300, nb.cells = 200)
plot(
prev.N300["k.wprev.N300.RInf"],
pal = prevR.colors.red,
lty = 0,
main = "Regional trends of prevalence (N=300)"
)
# Smoothing ring radii surface (spatial interpolation by kriging)
radius.N300 <- krige("r.radius", dhs, N = 300, nb.cells = 200)
plot(
radius.N300,
pal = prevR.colors.blue,
lty = 0,
main = "Radius of circle (N=300)"
)
par(ask = FALSE)
}
Run the code above in your browser using DataLab