Description Usage Arguments Details Value Author(s) References See Also Examples
This function is a user-friendly way to compute and test eigenvectors for various definitions of spatial weighting matrices.
It combines calls to the functions scores.listw
and ortho.AIC
.
It allows to test various definitions of the spatial weighting matrix and return results of scores.listw
for the best one.
1 |
Y |
A matrix with response variables (univariate or multivariate response). |
nb |
An object of the class |
xy |
Coordinates of the samples, this argument is optional and
is required only if the argument |
MEM.autocor |
A string indicating if all MEM must be returned or only those corresponding to positive or negative autocorrelation. |
f |
A function of the distance that can be used as a weighting spatial function. This argument is optional. |
... |
Others arguments for the function |
This functions allows to test one binary spatial weighting matrix (if only Y and nb are provided).
It allows also to test a weighting function based on distances (if f is provided) and a weighting function with different values of parameters if other arguments of f
are provided.
A list with the following elements:
all |
A data.frame where each row correspond to one spatial weighint matrix tested. It contains value of parameteres tested and corrected AIC and number of orthogonal vectors for the best model. |
best |
A list containing results of scores.listw and ortho.AIC of the best spatial weighting matrix according to corrected AIC. |
Stephane Dray
Dray S., Legendre P. and Peres-Neto P. R. (submitted) Spatial modeling: a comprehensive framework for principal coordinate analysis of neighbor matrices (PCNM). Ecological Modelling.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Not run:
data(oribatid)
# Hellinger transformation
fau <- sqrt(oribatid$fau/outer(apply(oribatid$fau,1,sum),rep(1,ncol(oribatid$fau)),"*"))
# remove gradient effect
faudt <- resid(lm(as.matrix(fau)~as.matrix(oribatid$xy)))
# test a binary spatial weighting matrix
nbtri <- tri2nb(as.matrix(oribatid$xy))
tri.res <- test.W(faudt,nbtri)
maxi <- max(unlist(nbdists(nbtri,as.matrix(oribatid$xy))))
# test a simple spatial weighting function of the distance
f1 <- function(x) {1-(x)/(maxi)}
tri.f1 <- test.W(faudt,nbtri,f=f1,xy=as.matrix(oribatid$xy))
# test a spatial weighting function with various values of parameters
f2 <- function(x,dmax,y) {1-(x^y)/(dmax)^y}
tri.f2 <- test.W(faudt,nbtri, f=f2,y=2:10,dmax=maxi,xy=as.matrix(oribatid$xy))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.