gen.variogram {phylin}R Documentation

Semi-variogram with the genetic distance matrix

Description

Computes the semi-variance with the real and genetic distances, and with user defined lag parameters.

Usage

gen.variogram(x, y, lag = quantile(as.matrix(x), 0.05), tol=lag/2, lmax = NA,
              bootstraps = 999, verbose = FALSE)

Arguments

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.

Details

This function produces a table with real lag centers and semi-variance. The formula to calculate semi-variance, γ(h)\gamma(h), is:

γ(h)=12n(h)i=1n[z(xi+h)z(xi)]2\gamma(h) = {\frac{1}{2 n(h)}} \sum_{i=1}^{n}[z(x_i + h) - z(x_i)]^2

where n(h)n(h) is the number of pairs with the lag distance hh between them, and zz is the value of the sample xx at the the location ii. The difference between sample z(xi+h)z(x_i+h) and sample z(xi)z(x_i) 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.

Value

Returns a 'gv' object with the input data, lag centers and semi-variance.

Note

It is assumed that the order of samples in x corresponds to the same in y.

Author(s)

Pedro Tarroso <ptarroso@cibio.up.pt>

References

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

See Also

plot.gv predict.gv gv.model

Examples


    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)


[Package phylin version 2.0.2 Index]