Description Usage Arguments Details Value Author(s) References See Also Examples
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
.
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)
|
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 |
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 ( |
plot.connexions |
Logical ( |
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.
A vector of weights associating a value to each edge of the graph.
Olivier Gauthier, Pierre Legendre and F. Guillaume Blanchet
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.
build.binary
,sp.correlogram
,mantel.correlog
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.