This step-1 function creates a matrix of spatial weights on the basis of a user-defined distance matrix, Kernel function, and bandwidth value. The distance matrix needs to specify a value for each of the possible $n by n$ binomials that correspond to n contextual units. It can be either symmetric or asymmetric. In principle, its diagonal, corresponding to the distance of each unit with itself, should be composed of zero values. A Kernel function proposed by default generates spatial weights that tend toward 1 for distances substantially lower than the bandwidth value, toward 0 for distances substantially higher than the bandwidth value and toward 0.5 for distances approaching the bandwidth value.
WeightMatrix(distance.matrix, bandwidth, kernel = NULL, moran = FALSE)
NULL
, in which
case the kernel function $$w_{ij}=f(d,h) =
\left(\frac{1}{2}\right)^{d_{ij}^2/h^2}$$ is used, where $w_ij, d_ij,
h$ are elements of the weight matrix $W$, of the
distance matrix $D$ and the bandwidth $h$.
User-supplied kernel functions have to take 2 arguments and return a
matrix of the same dimension as the first argument.
FALSE
.
distance.matrix
.
# creating geographical proximity weight, with bandwidth h=50
data(d_geo)
geow_50 <- WeightMatrix(distance.matrix=d_geo, bandwidth=50)
Run the code above in your browser using DataLab