Home > ggene, package, R > Geostatistics with genetic data : the R package ggene (part 2: variogram envelop)

Geostatistics with genetic data : the R package ggene (part 2: variogram envelop)

In this second item of a set of posts introducing the package `ggene`, we address how departure form spatial randomness can be examined.

Variogram envelop

The function `randsvariog` allows to compute the variogram envelope by means of randomizations. Each randomization corresponds to a random reallocation of genotypes among individuals followed by the recomputation of the variogram. Readers are referred to Legendre and Legendre (1998) for details about randomization tests in the context of spatial analyses.

`randsvariog` randomizes the genetic data associated to each individual but genomes are not changed, only their spatial distribution are permuted between individuals, hence the sampling design is kept unchanged.

First example

We illustrate this feature using the dataset `larix1350` where a set of 189 trees were genotyped (Nardin et al. 2015). Can we detect a spatial structure within this dataset?

First we load the dataset and have a look at the sampling design.

``````data(larix1300)
# check sample spatial features
plot(larix2300\$coord[,1],larix2300\$coord[,2], asp=1, xlab="x", ylab="y")
`````` Then we compute the variogram and plot it. The variogram shows very little structuration, if any.

``````# compute variogram
va <- svariog(X=larix1350, uvec=distlag(dist=larix1350\$coord, dmin=0, distance.lag=3), plot=TRUE)
`````` We now compute the statistical envelop using `randsvariog` with a limited number of randomizations in this simple example (a large number is otherwise necessary).

``````# compute statistical envelope
env <- randsvariog(var=va, X=larix1350, nsim=30, bounds=c(0.025, 0.975), save.sim=FALSE)
``````
```## ..............................
## done
```
``````# plot results
plot(env\$svario\$u, env\$svario\$v, ylim=range(env\$env), xlab="distance (m)",
ylab="semivariance")
points(env\$svario\$u, env\$env[,1], type="l")
points(env\$svario\$u, env\$env[,2], type="l")
`````` The statistical envelope indicates that most of the semivariance estimates lie between the 0.025 and 0.975 quantiles showing the absence of spatial genetic structure.

Second example

In this second example we perform similar analyses using the dataset `larix2300`:

``````data(larix2300)

# compute variogram
va <- svariog(X=larix2300, uvec=distlag(dist=larix2300\$coord, dmin=0,
distance.lag=3), plot=FALSE)

# compute statistical envelope
env <- randsvariog(var=va, X=larix2300, nsim=30, bounds=c(0.025, 0.975),
save.sim=FALSE)
``````
```## ..............................
## done
```
``````# plot results
plot(env\$svario\$u, env\$svario\$v, ylim=range(env\$env), xlab="distance (m)",
ylab="semivariance")
points(env\$svario\$u, env\$env[,1], type="l")
points(env\$svario\$u, env\$env[,2], type="l")
`````` In this case, the variogram indicates a clear departure from spatial randomness.

References

Legendre, P., Legendre, L., 2012. Numerical Ecology. Elsevier.

Nardin, M., Musch, B., Rousselle, Y., Guérin, V., Sanchez, L., Rossi, J.-P., Gerber, S., Marin, S., Pâques, L.E., Rozenberg, P., 2015. Genetic differentiation of European larch along an altitudinal gradient in the French Alps. Annals of Forest Science 72, 517-527.