Description Usage Arguments Details Value Author(s) References See Also Examples
Function to calculate spatial eigenvector maps of a set of locations in a space with an arbitrary number of dimension.
1 2 3 4 5 6 7 8 9 |
x |
A set of coordinates defined in one (numeric vector) or many
(a coordinate x dimension matrix) dimensions or, alternatively, a
distance matrix provided by |
opt.coord |
Coordinates to be used when a distance matrix is provided as x. Used for plotting purposes. |
weighting |
The function to obtain the edge weighting
matrix. That function must have the raw distances as a first
parameter, optionally a second parameter named
Functions |
boundaries |
(optional) Threshold values (minimum and maximum)
used to obtain the connectivity matrix. Pairs of location whose
distance to one another are between these values are considered as
neighbours (b_{i,j}=1) whereas values located below
the mininum and above the maximum are considered as equivallent or
distant, respectively (b_{i,j}=0 in both
cases). Defaults are 0 for the minimum value and |
. Ignored when weighting="Wf.sqrd"
or weighting="Wf.RBF"
.
wpar |
Weighting function parameters. |
select |
The smallest absolute eigenvalue for eigenfunctions to
be considered as a suitable predictive variables. Default value
depends on one's particular computer and is set to the square-root
of |
D |
A distance matrix. |
object |
A |
target |
A set of distances between the sampling locations
(passed to |
Spatial eigenvector maps are sets of eigenfunctions obtained from the
locations of the observations in a structuring framework, e.g.,
space, time, or in a graph. It is obtained by eigenvalue
decomposition of a spatial weighting matrix, computed as described
in Dray et al. (2006) and Legendre & Legendre (2012, Section
14.2). That square matrix is Gower-centred before
eigen-decomposition. The spatial weighting matrix is the Hadamard
product of a connectivity matrix B and an edge
weighting matrix A. The function described herein
handles user-chosen truncation parameters to calculate
B and provides a default approach to estimate
these parameters should they be missing. It also offers four
different ways of computing A through parameters
weighting
and wpar
.
In is noteworthy that in the present implementation, matrix B is not obtained using a minimum spanning tree as suggested by Dray et al. (2006) but using a simpler approach whereby every distances within a user-defined trunction interval are taken as neighbour.
Functions Wf.sqrd
, Wf.RBF
,
Wf.binary
, Wf.PCNM
,
Wf.Drayf1
, Wf.Drayf2
, and
Wf.Drayf3
are not intested to be called as is but
through eigenmap
(and within
eigenmap.score
). Other, user-defined, function can be
used by eigenmap
and should be visible to if one wants
to call eigenmap.score
to obtain predictors.
For eigenmap.score
, the distances between sampling
locations and the targets locations must be of the same type as
those that had been passed to eigenmap
. If cartesian
coordinates were passed to x
, the distances to target must be
Euclidean.
eigenmap
returns a eigenmap-class
object
and eigenmap.score
returns a the scores on for each
target locations
Guillaume Guénard, Departement des sciences biologiques, Universite de Montréal, Montréal, Quebec, Canada.
Borcard, D. and Legendre, P. 2002. All-scale spatial analysis of ecological data by means of principal coordinates of neighbour matrices. Ecol. Model. 153: 51-68
Dray, S.; Legendre, P. and Peres-Neto, P. 2006. Spatial modelling: a comprehensive framework for principal coordinate analysis of neighbor matrices (PCNM). Ecol. Modelling 196: 483-493
Legendre, P. and Legendre, L. 2012. Numerical Ecology, 3rd English edition. Elsevier Science B.V., Amsterdam, The Neatherlands.
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #
### Example 1: A linear transect.
#
data(Salmon)
#
## No boundaries provided for a function that requires them: a warning is issued
map <- eigenmap(x=Salmon[,"Position"],weighting=Wf.binary)
map # plot(map)
#
## Boundaries are provided: the function is happy
map <- eigenmap(x=Salmon[,"Position"],weighting=Wf.binary,boundaries=c(0,20))
map # plot(map)
#
map <- eigenmap(x=Salmon[,"Position"],weighting=Wf.Drayf1,boundaries=c(0,20))
map # plot(map)
#
map <- eigenmap(x=Salmon[,"Position"],weighting=Wf.Drayf2,boundaries=c(0,20))
map # plot(map)
#
map <- eigenmap(x=Salmon[,"Position"],weighting=Wf.Drayf3,boundaries=c(0,20),wpar=2)
map # plot(map)
#
map <- eigenmap(x=Salmon[,"Position"],weighting=Wf.PCNM,boundaries=c(0,20))
map # plot(map)
#
map <- eigenmap(x=Salmon[,"Position"],weighting=Wf.sqrd)
map # plot(map)
#
map <- eigenmap(x=Salmon[,"Position"],weighting=Wf.RBF,wpar=0.001)
map # plot(map)
#
### Example 2: Using predictior scores
#
smpl <- c(4,7,10,14,34,56,61,64) # A sample to discard
map <- eigenmap(x=Salmon[-smpl,"Position"],weighting=Wf.sqrd)
scr <- eigenmap.score(object=map,target=as.matrix(dist(Salmon[,"Position"]))[,-smpl])
all(round(scr[-smpl,] - map$U, 10) == 0) # Scores of sampling points are the eigenvectors
scr[smpl,]
#
wh <- 5L # You can try with other vectors.
plot(map$U[,wh]~Salmon[-smpl,"Position"], ylab = expression(U[5]),
xlab = "Position along transect")
points(y=scr[smpl,wh],x=Salmon[smpl,"Position"],pch=21,bg="black")
#
map <- eigenmap(x=Salmon[-smpl,"Position"],weighting=Wf.binary,boundaries=c(0,20))
scr <- eigenmap.score(object=map,target=as.matrix(dist(Salmon[,"Position"]))[smpl,-smpl])
#
wh <- 1L # You can try with other vectors.
plot(map$U[,wh]~Salmon[-smpl,"Position"], ylab = expression(U[1]),
xlab = "Position along transect (m)")
points(y=scr[,wh],x=Salmon[smpl,"Position"],pch=21,bg="black")
#
map <- eigenmap(x=Salmon[-smpl,"Position"],weighting=Wf.PCNM,boundaries=c(0,100))
scr <- eigenmap.score(object=map,target=as.matrix(dist(Salmon[,"Position"]))[smpl,-smpl])
#
wh <- 1L # You can try with other vectors.
plot(map$U[,wh]~Salmon[-smpl,"Position"], ylab = expression(U[1]),
xlab = "Position along transect (m)")
points(y=scr[,wh],x=Salmon[smpl,"Position"],pch=21,bg="black")
#
### Example 3: A unevenly sampled surface.
#
data(Mite)
map <- eigenmap(x=as.matrix(mite.geo),weighting=Wf.sqrd)
map # plot(map)
#
map <- eigenmap(x=as.matrix(mite.geo),weighting=Wf.RBF)
map # plot(map)
#
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.