### Example 1: A linear transect.
data(salmon)
## A warning is issued when no boundaries are provided for a function that
## requires them.
## Example:
map <- eigenmap(x = salmon[,"Position"], weighting = wf.binary)
map
## plot(map)
## In the following examples, boundaries are provided; they are needed by the
## functions.
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 predictor scores
smpl <- c(4,7,10,14,34,56,61,64) # A sample to be discarded
map <- eigenmap(x = salmon[-smpl,"Position"], weighting = wf.sqrd)
scr <- eigenmap.score(
map, target = as.matrix(dist(salmon[,"Position"]))[,-smpl]
)
## 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 = 21L,
bg = "black")
map <- eigenmap(x = salmon[-smpl,"Position"], weighting = wf.binary,
boundaries = c(0,20))
scr <- eigenmap.score(
map, target = as.matrix(dist(salmon[,"Position"]))[smpl,-smpl])
## Plot the 8 prediction sites along particular eigenvectors, here
## eigenvector #1:
wh <- 1L # One could try the other vectors.
plot(map$U[,wh] ~ salmon[-smpl,"Position"], ylab = expression(U[1L]),
xlab = "Position along transect (m)")
points(y = scr[,wh], x = salmon[smpl,"Position"], pch=21L, bg = "black")
map <- eigenmap(x = salmon[-smpl,"Position"], weighting = wf.PCNM,
boundaries = c(0,100))
scr <- eigenmap.score(
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 = 21L, bg = "black")
### Example 3: A unevenly sampled surface.
data(mite)
## Example using the principal coordinates of the square root of the
## (Euclidean) distances:
map <- eigenmap(x = as.matrix(mite.geo), weighting = wf.sqrd)
map
## plot(map)
## Example using the radial basis functions (RBF):
map <- eigenmap(x = as.matrix(mite.geo), weighting = wf.RBF)
map
## plot(map)
Run the code above in your browser using DataLab