weight.edges: Weight edges when constructing AEM variables

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/weight.edges.R

Description

These functions construct a vector of weights that can be associated to the edges of the connexion diagram used as a basis to build AEM eigenfunctions. weight.edges is general and can be used for 1 or 2 dimensional problems. weight.time is meant to be used only for time series. It is a wrapper for weight.edges.

Usage

1
2
weight.edges(nb.object, coords, distmat = NULL, alpha = 2, beta = NULL, max.d = NULL, unit.angle = "degrees", rot.angle = 0, rm.same.y = TRUE, plot.connexions = TRUE)
weight.time(dates, distmat = NULL, alpha = 2, beta = NULL, max.d = NULL, unit.angle = "degrees", rot.angle = 0, rm.same.y = TRUE, plot.connexions = TRUE)

Arguments

dates

A vector of dates, class 'numeric' or 'Date'.

nb.object

Object with class 'nb', computed by the spdep package, containing a list of neighbours for each sampling unit (site or time).

coords

A three-column matrix or data frame. Column 1: identifiers of the points (must be numeric). Columns 2 and 3: the X and Y coordinates of the points.

distmat

Class 'matrix' or 'dist' object containing a dissimilarity or distance matrix. (See details).

alpha

Numeric. Exponent of the first weighting function. (See details).

beta

Numeric. Exponent of the second weighting function. (See details).

max.d

Numeric. Maximum distance for weighting. Default value if max.d=NULL: the maximum distance among a set of sites divided by 2 or the full span of a time series divided by 2 (not recommended in most problems, see details). A warning is given if max.d=NULL and the default value is used.

unit.angle

Character. The measurement units in which the angle is defined: either "degrees" (default) or "radians".

rot.angle

Numeric. Angle of the vector describing the process influencing the sites. This argument generates a rotation of the site coordinates. The set of coordinates is rotated counterclockwise. Negative values will produce a clockwise rotation.

rm.same.y

Logical (TRUE, FALSE). Determines if the links perpendicular to the gradient should be removed. Default value: TRUE. If these links have already been removed, this argument put to TRUE will make the function crash. See details for more information.

plot.connexions

Logical (TRUE, FALSE). Determines if the sites and the associated connexion diagram should be plotted after rotation of the coordinates by gradient.angle.

Details

These functions should be used in close relationship with build.binary, consequently many of the arguments in this function and in build.binary are the same.

The argument distmat may contain general forms of dissimilarity, for example the difficulty of transfer of individuals, matter or energy among the sampling units through space or time.

In weight.edges, two weighting functions, described in Legendre and Legendre (2012, eqs. 114.3 and 14.4) have been implemented, where d_{ij} is the distance between sites i and j:

Weighting function 1: 1 - (d_{ij}/max(d))^alpha
Weighting function 2: 1/d_{ij}^beta

Also note that if a value is provided for beta (that is, if it is not NULL), weighting function 2 is used regardless of whether alpha is defined or not.

In most applications, the default value of max.d is not optimal. A more meaningful solution in many applications is to compute a Moran's I correlogram (for univariate data) or a Mantel correlogram (for multivariate data), and provide the distance where the correlation becomes 0 as the value for max.d.

Value

A vector of weights associating a value to each edge of the graph.

Author(s)

Olivier Gauthier, Pierre Legendre and F. Guillaume Blanchet

References

Legendre, P. and L. Legendre. 2012. Numerical Ecology, 3rd English edition. Elsevier Science BV, Amsterdam.

Legendre, P. and O. Gauthier. Statistical methods for temporal and space-time analysis of community composition data. (In preparation)

Legendre, P. and L. Legendre. 2012. Numerical ecology, 3rd English edition. Elsevier Science BV, Amsterdam.

See Also

build.binary,sp.correlogram,mantel.correlog

Examples

 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
### Time serie example
###  Example - 12 dates (days from January 1st of year 1) in a 6-year study starting September 5, 2000
###########################################################################
dates <- as.Date(c(129,269,500,631,864,976,1228,1352,1606,1730,1957,2087),origin="2000/1/1")
autocor.limit <- 522  # Limit of autcorrelation in the correlogram

### Using weight.time()
(wtime <- weight.time(dates, alpha=2, max.d=autocor.limit))

### Using weight.edges()
n <- length(dates)
nb <- cell2nb(1, n)
xy.dates <- cbind(1:n, rep(1, n), dates)
(wtime <- weight.edges(nb, xy.dates, alpha=2, max.d=autocor.limit))

n <- length(dates)
nb <- cell2nb(1, n)
xy.dates <- cbind(1:n, dates, rep(1, n)) ## Note the inversion of 'dates' and 'rep(1,n)'
(wtime <- weight.edges(nb, xy.dates, alpha=2, max.d=autocor.limit,rot.angle=90)) # Note that 'rot.angle=90' was used

### Spatial example using default d.max (notice the warning)
###########################################################################
nb<-cell2nb(5,5,"queen")
xy <- cbind(1:25,expand.grid(1:5,1:5))
(wspace <- weight.edges(nb,xy))

AEM documentation built on May 31, 2017, 3:31 a.m.