makeDists | R Documentation |
This function makes two Euclidean distance matrices. One for the distances between all spatial observations and all spatial knot locations. The other, if specified, is the distances between knot locations. It is experimental owing to the addition of the creation of infinity-block distance matrices. The original functionality is unchanged.
makeDists(
datacoords,
knotcoords,
knotmat = TRUE,
polys = NULL,
type = "A",
plot.transition = FALSE,
grid.dim = c(100, 100)
)
datacoords |
Coordinates of the data locations. If a design matrix interaction is required, add a third column containing the factor level. |
knotcoords |
Coordinates of the legal knot locations. If a design matrix interaction is required, add a third column containing the factor level for each knot location. |
knotmat |
( |
polys |
( |
type |
( |
plot.transition |
( |
grid.dim |
This is a vector of length two which specifies the dimesions of the grid used to create the transition matrix (default |
The data-knot matrix is used in the CReSS basis and the knot-knot matrix is used in SALSA to determine where a nearest knot to ‘move’ should be.
If three columns are provided for datacoords
and knotcoords
the matrix returned has infinity for distances between knots and data associated with differing factor levels.
# load data
data(ns.data.re)
# load knot grid data
data(knotgrid.ns)
# make distance matrices for datatoknots and knottoknots
distMats<-makeDists(cbind(ns.data.re$x.pos, ns.data.re$y.pos), na.omit(knotgrid.ns))
# ~~~~~~~~~~~~~~~~~~
# Example with block-infinity distance matrix
data(nysted.analysisdata)
myknots <- selectFctrKnots(nysted.analysisdata[,c('x.pos', 'y.pos', 'impact')], nk=150)
dists <- makeDists(datacoords = nysted.analysisdata[,c('x.pos', 'y.pos', 'impact')],
knotcoords = myknots,
knotmat = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.