Tuesday, May 25, 2010
Monday, May 24, 2010
Monday, May 17, 2010
k=1
knn1 = knearneigh(afghan.centers,k,longlat=T)
afghan.knn1 = knn2nb(knn1)
plot(afghan)
plot(afghan.knn1,afghan.centers,col="blue",add=T)
k=2
knn2 = knearneigh(afghan.centers,k,longlat=T)
afghan.knn2 = knn2nb(knn2)
plot(afghan)
plot(afghan.knn2,afghan.centers,col="red",add=T)
k=3
knn3 = knearneigh(afghan.centers,k,longlat=T)
afghan.knn3 = knn2nb(knn3)
plot(afghan)
plot(afghan.knn3,afghan.centers,col="green",add=T)
k=4
knn4 = knearneigh(afghan.centers,k,longlat=T)
afghan.knn4 = knn4nb(knn4)
plot(afghan)
plot(afghan.knn4,afghan.centers,col="darkblue",add=T)
k=5
knn5 = knearneigh(afghan.centers,k,longlat=T)
afghan.knn5 = knn5nb(knn5)
plot(afghan)
plot(afghan.knn5,afghan.centers,col="darkblue",add=T)
d = 100
afghan.dist.100 = dnearneigh(afghan.centers,0,d,longlat=T)
plot(afghan)
plot(afghan.dist.100,afghan.centers,add=T,lwd=2,col="red")
summary(afghan.dist.100)
d = 150
afghan.dist.150 = dnearneigh(afghan.centers,0,d,longlat=T)
plot(afghan)
plot(afghan.dist.150,afghan.centers,add=T,lwd=2,col="2")
summary(afghan.dist.150)
d = 200
afghan.dist.200 = dnearneigh(afghan.centers,0,d,longlat=T)
plot(afghan)
plot(afghan.dist.200,afghan.centers,add=T,lwd=2,col="2")
summary(afghan.dist.200)
d = 50
afghan.dist.50 = dnearneigh(afghan.centers,0,d,longlat=T)
plot(afghan)
plot(afghan.dist.50,afghan.centers,add=T,lwd=2,col="2")
summary(afghan.dist.50)
plot(afghan)
plot(afghan.lags[[2]],afghan.centers, add=T,lwd=3,col="green",lty=2)
afghan.lags = nblag(afghan.knn2,3)
plot(afghan)
plot(afghan.lags[[3]],afghan.centers, add=T,lwd=3,col="green",lty=2)
w.cols = 1:32
w.rows = 1:32
w.mat.knn = nb2mat(afghan.knn1, zero.policy=TRUE)
w.mat.knn
image(w.cols,w.rows,w.mat.knn,col=brewer.pal(3,"BuPu"))
w.mat.dist = nb2mat(afghan.dist.250, zero.policy=TRUE)
image(w.cols,w.rows,w.mat.dist,col=brewer.pal(9,"PuRd"))
knn1 = knearneigh(afghan.centers,k,longlat=T)
afghan.knn1 = knn2nb(knn1)
plot(afghan)
plot(afghan.knn1,afghan.centers,col="blue",add=T)
k=2
knn2 = knearneigh(afghan.centers,k,longlat=T)
afghan.knn2 = knn2nb(knn2)
plot(afghan)
plot(afghan.knn2,afghan.centers,col="red",add=T)
k=3
knn3 = knearneigh(afghan.centers,k,longlat=T)
afghan.knn3 = knn2nb(knn3)
plot(afghan)
plot(afghan.knn3,afghan.centers,col="green",add=T)
k=4
knn4 = knearneigh(afghan.centers,k,longlat=T)
afghan.knn4 = knn4nb(knn4)
plot(afghan)
plot(afghan.knn4,afghan.centers,col="darkblue",add=T)
k=5
knn5 = knearneigh(afghan.centers,k,longlat=T)
afghan.knn5 = knn5nb(knn5)
plot(afghan)
plot(afghan.knn5,afghan.centers,col="darkblue",add=T)
d = 100
afghan.dist.100 = dnearneigh(afghan.centers,0,d,longlat=T)
plot(afghan)
plot(afghan.dist.100,afghan.centers,add=T,lwd=2,col="red")
summary(afghan.dist.100)
d = 150
afghan.dist.150 = dnearneigh(afghan.centers,0,d,longlat=T)
plot(afghan)
plot(afghan.dist.150,afghan.centers,add=T,lwd=2,col="2")
summary(afghan.dist.150)
d = 200
afghan.dist.200 = dnearneigh(afghan.centers,0,d,longlat=T)
plot(afghan)
plot(afghan.dist.200,afghan.centers,add=T,lwd=2,col="2")
summary(afghan.dist.200)
d = 50
afghan.dist.50 = dnearneigh(afghan.centers,0,d,longlat=T)
plot(afghan)
plot(afghan.dist.50,afghan.centers,add=T,lwd=2,col="2")
summary(afghan.dist.50)
plot(afghan)
plot(afghan.lags[[2]],afghan.centers, add=T,lwd=3,col="green",lty=2)
afghan.lags = nblag(afghan.knn2,3)
plot(afghan)
plot(afghan.lags[[3]],afghan.centers, add=T,lwd=3,col="green",lty=2)
w.cols = 1:32
w.rows = 1:32
w.mat.knn = nb2mat(afghan.knn1, zero.policy=TRUE)
w.mat.knn
image(w.cols,w.rows,w.mat.knn,col=brewer.pal(3,"BuPu"))
w.mat.dist = nb2mat(afghan.dist.250, zero.policy=TRUE)
image(w.cols,w.rows,w.mat.dist,col=brewer.pal(9,"PuRd"))
Moran I statistic standard deviate = -1.5163, p-value = 0.9353
alternative hypothesis: greater
Tuesday, May 11, 2010
Tuesday, May 4, 2010
Subscribe to:
Posts (Atom)