Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/gen.variogram.R
Computes the semi-variance with the real and genetic distances, and with user defined lag parameters.
1 2 |
x |
Real distances matrix. |
y |
Single genetic distances matrix or list of genetic distances matrices. |
lag |
Real distance corresponding to the desired 'lag' interval. This is used to calculate lag centers from 0 to 'lmax'. |
tol |
Tolerance for the lag center to search for pairs ('lag'-'tol', 'lag'+'tol'). |
lmax |
Maximum distance for lag centers. Pairs with distances higher than 'lmax' are not included in the calcualtion of the semi-variance. If 'lmax' is NA (default) then is used the maximum distance between samples. |
bootstraps |
This is the number of bootstraps used to calculate 95% confidence interval for the median, when multiple genetic distances are given. With a single genetic distance, this parameter is ignored. |
verbose |
Boolean for verbosity. When TRUE and with multiple genetic distance matrices, a log of error evolution is printed. |
This function produces a table with real lag centers and semi-variance. The formula to calculate semi-variance, γ(h), is:
y(h) = 1/(2*n(h)) * sum((z(xi+h) - z(xi))**2)
where n(h) is the number of pairs with the lag distance h between them, and z is the value of the sample x at the the location i. The difference between sample x(xi+h) and sample x(xi) is assumed to correspond to their genetic distance.
Multiple genetic distance matrices can be used. In this case, a variogram is computed for each genetic distance and the results summarised by the median and a 95% confidence interval calculated with bootstraps.
Returns a 'gv' object with the input data, lag centers and semi-variance.
It is assumed that the order of samples in x corresponds to the same in y.
Pedro Tarroso <ptarroso@cibio.up.pt>
Fortin, M. -J. and Dale, M. (2006) Spatial Analysis: A guide for Ecologists. Cambridge: Cambridge University Press.
Isaaks, E. H. and Srivastava, R. M. (1989) An Introduction to applied geostatistics. New York: Oxford University Press.
Legendre, P. and Legendre, L. (1998) Numerical ecology. 2nd english edition. Amesterdam: Elsevier
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | data(vipers)
data(d.gen)
# create a distance matrix between samples
r.dist <- dist(vipers[,1:2])
# variogram table with semi-variance and lag centers
gv <- gen.variogram(r.dist, d.gen)
# plot variogram
plot(gv)
# fit a new variogram with different lag
gv2 <- gen.variogram(r.dist, d.gen, lag=0.2)
plot(gv2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.