powered by
A function that returns a row normalized weight matrix based on k first neighbors, to be documented
KNN(coord,h,diagnull=TRUE,kernel='knn',query=NULL)
matrix of coordinates
a bandwidth
0 on diagonal, default TRUE
kernel type ('bisq','bisq_knn','gauss','gauss_adapt','knn')
an index of neighbors to consider, if NULL all observation are used.
a row nomralized weight dgCmatrix
# NOT RUN { data(mydata) coord=as.matrix(mydata[,c("x_lat","y_lon")]) W=KNN(coord,8) which(W[1,]>0) W[1,W[1,]>0] # }
Run the code above in your browser using DataLab