Last chance! 50% off unlimited learning
Sale ends in
eigenmap(x,opt.coord=NA,weighting=Wf.sqrd,boundaries,wpar,select=.Machine$double.eps^0.5)
Wf.sqrd(D)
Wf.binary(D,boundaries)
Wf.PCNM(D,boundaries)
Wf.Drayf1(D,boundaries)
Wf.Drayf2(D,boundaries,wpar=1)
Wf.Drayf3(D,boundaries,wpar=1)
eigenmap.score(object,target)
dist
. Coordinates are
treated as cartesianboundaries
giving the boundaries of the within which locations are regarded as
.Machine$double.eps
eigenmap-class
object.eigenmap
using x
) and the target
locations where spatially-explicit predictions are to be made.eigenmap
returns a eigenmap-class
object
and eigenmap.score
returns a the scores on for each
target locationsweighting
and wpar
.In is noteworthy that in the present implementation, matrix $\mathbf{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.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.
Legendre, P. and Legendre, L. 2012. Numerical Ecology, 3rd English edition. Elsevier Science B.V., Amsterdam, The Neatherlands.
MCA
eigenmap-class
#
### 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)
#
### 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"])
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"])
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"])
points(y=scr[,wh],x=Salmon[smpl,"Position"],pch=21,bg="black")
#
### Example 3: A unevenly sampled surface.
#
## Require package vegan
library(vegan)
data(mite.xy)
map <- eigenmap(x=as.matrix(mite.xy),weighting=Wf.sqrd)
map # plot(map)
#
Run the code above in your browser using DataLab