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", new.window=FALSE)
plot(dhs, type="c.type", main="Clusters by residence", new.window=FALSE)
plot(dhs, type="count", main="Observations by cluster", new.window=FALSE)
plot(dhs, type="flower", main="Positive cases by cluster", new.window=FALSE)
# Changing coordinates projection
plot(dhs,axes=TRUE,new.window=FALSE)
dhs <- changeproj(dhs,
"+proj=utm +zone=30 +ellps=WGS84 +datum=WGS84 +units=m +no_defs")
print(dhs)
plot(dhs, axes=TRUE, new.window=FALSE)
# 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)
spplot(prev.N300, 'k.wprev.N300.RInf',
cuts=100, col.regions=prevR.colors.red(101),
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)
spplot(radius.N300,
cuts=100, col.regions=prevR.colors.blue(101),
main="Radius of circle (N=300)"
)
par(ask = FALSE)Run the code above in your browser using DataLab