proximity_builder {sim2Dpredictr} | R Documentation |
Generate a Proximity Matrix
Description
Generates a proximity matrix where non-zero entries are the weights associated with neighbors, and zero entries are not neighbors.
Usage
proximity_builder(
im.res,
neighborhood = "ar1",
type = c("sparse", "full"),
weight = "binary",
phi = 1,
r = NULL,
h = NULL,
w = NULL,
include.coords = FALSE,
print.im = FALSE
)
Arguments
im.res |
A vector defining the dimension of spatial data. The first entry is the number of rows and the second entry is the number of columns. |
neighborhood |
Determines how to assign neighbor status to locations;
i.e. 1 for neighbors, 0 otherwise. |
type |
Specifies either sparse ( |
weight |
Determines how weights are assigned. |
phi |
When |
r , h , w |
When |
include.coords |
If |
print.im |
Allows user to print the 2D "image" matrix with index labels to visually verify that the proximity matrix is as expected. |
Value
A (proximity) matrix.
Examples
## Not run:
## adjacency matrix with sparse structure (i.e., 2 columns)
## and ar1 neighborhood
sp.ar1 <- proximity_builder(im.res = c(3, 3),
weight = "binary",
neighborhood = "ar1",
type = "sparse")
## adjacency matrix with full structure
## (i.e., prod(im.dim) rows & columns) and ar1 neighborhood
full.ar1 <- proximity_builder(im.res = c(3, 3),
weight = "binary",
neighborhood = "ar1",
type = "full")
## proximity matrix weighted by distance (sparse)
sp.rnd <- proximity_builder(im.res = c(3, 3),
weight = "distance",
neighborhood = "round", r = 2,
type = "sparse",
include.coords = TRUE)
## proximity matrix weighted by distance (full)
full.rnd <- proximity_builder(im.res = c(3, 3),
weight = "distance",
neighborhood = "round", r = 2,
type = "full")
## End(Not run)