Spatial Distribution of IED
Improvised explosive devices (IED's) are planted in a city block of
25 square miles (exactly a 5-by-5-miles square). For every
week the number of newly found IED's in this block is approximated
by a Poisson distribution with
, and the locations
of these IED's are scattered uniformly over the city block.
week = 1:50 lambda = 10 X = NULL Y = NULL WK = NULL n = 0 for(i in week){ size = rpois(1,lambda) if(size > 0){ X[(n+1):(n+size)] = runif(size,0,5) Y[(n+1):(n+size)] = runif(size,0,5) WK[(n+1):(n+size)] = i n = n + size } } WK = factor(WK,levels=week)The location of every incident in 50 weeks is visualized in the entire 5-by-5-mile square. And the 2-by-2-mile square is highlighted at the south-west corner.
plot(c(0,5),c(0,5),type='n') points(X,Y,pch=4,col='red') text(X,Y,as.character(WK),pos=3) lines(c(0,0,2,2,0),c(0,2,2,0,0),lty=2,col='blue')The number of IED's in the entire 5-by-5-miles square follows a Poisson distribution with

count = table(WK) hist(count, freq=F, breaks=seq(-0.5,max(count)+0.5,by=1.0),col='green') cat("\n count =", count) cat("\n mean count =", mean(count)) cat("\n var of count =", var(count)) x = 0:max(count) ppmf = dpois(x,lambda) prob.mass(x,ppmf,col='red',density=10) legend(x=0.7*max(count), y=max(ppmf)*1.2, legend=c('Data','Poisson'), col=c('green','red'),pch=c(15,22))Suppose that you are responsible for sweeping and clearing the south-west corner of 2-by-2-mile square block every week. Then we can restrict the spetial data for the specified area.
SW = X <= 2 & Y <= 2 plot(c(0,2),c(0,2),type='n') points(X[SW],Y[SW],pch=4,col='red') text(X[SW],Y[SW],as.character(WK[SW]),pos=3) lines(c(0,0,2,2,0),c(0,2,2,0,0),lty=2,col='blue')To create the data for frequency at the specified area, we need to process the spetial data as follows:
count = table(WK[SW]) hist(count, freq=F, breaks=seq(-0.5,max(count)+0.5,by=1.0),col='green') cat("\n count =", count) cat("\n mean count =", mean(count)) cat("\n var of count =", var(count))The average number of IED's in a week is


lambda2 = lambda * (4/25) x = 0:max(count) ppmf = dpois(x,lambda2) prob.mass(x,ppmf,col='red',density=10) legend(x=0.7*max(count), y=max(ppmf)*1.1, legend=c('Data','Poisson'), col=c('green','red'),pch=c(15,22))
Sample R code. You can download ied.R, and run it.
© TTU Mathematics