weighting-functions | R Documentation |
A set of common distance weighting functions to calculate spatial eignevector
maps using function eigenmap
.
wf.sqrd(d)
wf.RBF(d, wpar = 1)
wf.PCNM(d, boundaries, wpar = 4)
wf.binary(d, boundaries)
wf.Drayf1(d, boundaries)
wf.Drayf2(d, boundaries, wpar = 1)
wf.Drayf3(d, boundaries, wpar = 1)
d |
A triangular ('dist-class') or rectangular geographic
distance matrix produced by |
wpar |
Where applicable, a parameter controlling the shape of the spatial weighting function. |
boundaries |
Where applicable, a two-element numeric vector containing the lower and upper threshold values used to obtain the connectivity matrix. (see details). |
These functions are meant primarily to be called within functions
eigenmap
and eigenmap.score
. In
eigenmap
, argument d
is a lower-triangular
'dist-class' object and the resulting lower-triangular weight matrix
is used in calculating the spatial eigenvector map. In
eigenmap.score
, d
is a rectangular matrix of the
distances between a set of arbitrary locations (rows) and reference locations
(columns; the locations for which the the spatial eigenvector map has been
built and the resulting rectangular weight matrix is used to calculate
spatial eigenfunction values. These values allow one to use the spatial
information of a data set for making predictions at arbitrary values.
'Wf.sqrd' (default value) consists in taking w_i,j = -0.5*d_i,j and does not involve any truncation.
'Wf.RBF' consists in taking w_i,j = exp(-wpar*d_i,j^2) and does not involve any truncation, where wpar is a non-zero real positive value (default: 1).
'Wf.binary' the spatial weighting matrix is simply the connectivity matrix.
'Wf.PCNM' is a_i,j = 1 - (d_i,j / (wpar*boundaries_2))^2, where wpar is a non-zero real positive value (default: 4).
'Wf.Drayf1' is a_i,j = 1 - (d_i,j / d_max) where d_max is the distance between the two most distant locations in the set.
'Wf.Drayf2' is a_i,j = 1 - (d_i,j / d_max)^wpar, where wpar is a non-zero real positive value (default: 1).
'Wf.Drayf3' is a_i,j = 1 / d_i,j^wpar, where wpar is a non-zero real positive value (default: 1).
Functions Wf.Drayf1
, Wf.Drayf2
, and Wf.Drayf3
were
proposed by Dray et al. (2006) and function PCNM
was proposed by
Legendre and Legendre (2012).
The Wf.sqrd
weighting approach is equivalent to submitting the
elementwise square-root of the distance matrix to a principal coordinate
analysis. It was proposed by Diniz-Filho et al. (2013) and is equivalent, for
evenly spaced transect or surfaces (square or rectangle), to using the basis
functions of type II discrete cosine basis transforms; a fact that has gone
unnoticed by Diniz-Filho et al. (2013).
The radial basis function (RBF) is a widespread kernel method involving sets
of real-valued functions whose values depend on the distance between any
given input coordinate and a set of fixed points (a single fixed point for
each function). It is implemented using function Wf.RBF
using all the
sampling points as the fixed points.
When calculating the connectivity matrix, pairs of location whose distance to
one another are between the boundary values (argument bounraries
) are
considered as neighbours (b_i,j=1) whereas values located below the
minimum and above the maximum are considered as equivalent or distant,
respectively (b_i,j=0 in both cases).
User may implement custom weighting functions. These functions must at the
very least have an argument d
, and can be given arguments
boundaries
and wpar
. Argument wpar
may be a vector with
any number of elements. They should be added to the R-code file
(weighting-functions.R). User-provided weighting functions with an argument
wpar
must come with a valid default value for that parameter since
eigenmap
may internally call it without a formal value.
A 'dist-class' object when argument d
is a
'dist-class' object or a rectangular matrix when argument d
is
a rectangular matrix, either one with the weights as its values.
wf.sqrd()
: Principal coordinates of the square-root distance matrix (Diniz-Filho et al.
2013).
wf.RBF()
: Radial basis functions with the observations as the kernels.
wf.PCNM()
: Borcard & Legendre's (2002) principal coordinates of the neighbour matrix
approach.
wf.binary()
: Dray et al. (2006) Moran's eigenvector maps (distance-based binary
connections without continuous weighting of the neighbours).
wf.Drayf1()
: Dray et al. (2006) Moran's eigenvector maps (distance-based binary
connections with continuous weighting of the neighbours: f1).
wf.Drayf2()
: Dray et al. (2006) Moran's eigenvector maps (distance-based binary
connections with continuous weighting of the neighbours: f2).
wf.Drayf3()
: Dray et al. (2006) Moran's eigenvector maps (distance-based binary
connections with continuous weighting of the neighbours: f3).
Guillaume Guenard and Pierre Legendre, Bertrand Pages Maintainer: Guillaume Guenard <guillaume.guenard@gmail.com>
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
Diniz-Filho, J. A. F.; Diniz, J. V. B. P. L.; Rangel, T. F.; Soares, T. F.; de Campos Telles, M. P.; Garcia Collevatti, R. and Bini, L. M. 2013. A new eigenfunction spatial analysis describing population genetic structure. Genetica 141:479-489.
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 Netherlands.
locations <- c(1,2,4,7,10,14,17,21)
D <- dist(locations)
wf.sqrd(D)
wf.RBF(D, wpar = 0.1)
wf.binary(D, c(0,5))
wf.PCNM(D, c(0,5))
wf.Drayf1(D, c(0,5))
wf.Drayf2(D, c(0,5), 0.5)
wf.Drayf3(D, c(0,5), 0.5)
emap <- eigenmap(D, locations, wf.Drayf2, c(0,5), 0.5)
emap
emap <- eigenmap(D, locations, wf.Drayf3, c(0,5), 0.25)
emap
emap <- eigenmap(D, locations, wf.RBF, wpar = 0.1)
emap
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.