svariog: Semivariogram computation

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

Description

Computes empirical variograms. Allows directional variograms estimation and weighting for recurrent genotypes

Usage

1
svariog(X, plot=TRUE, messages=FALSE, ...)

Arguments

X

a ggene object.

plot

logical with default to FALSE. If TRUE a plot of the variogram is displayed.

messages

Logical. If TRUE the function returns various messages during computation.

...

optional arguments see variog (package geoR).

Details

The function relies on the function variog from package geoR and accepts similar arguments. Readers are referred to the help page of the function variog for details.

The optional arguments are :

uvec

a vector with values used to define the variogram binning. Possibly created using distlag.

max.dist

a numerical value defining the maximum distance considered to constitute pairs of individuals.

direction

a numerical value comprised in the interval: [0, pi] radians ([0, 180] degrees) for the directional (azimuth) angle defining the directional variograms.

tolerance

numerical value comprised in the interval [0, pi/2] radians ([0, 90] degrees) indicating the tolerance angle for directional variograms computation. Default set to pi/8.

unit.angle

defines the unit for the specification of angles (radians or degrees). Default set to radians.

Value

An object of class svariog A list of 5 items:

svario

an object of class variogram (package geoR).

Hhat

conventional estimation of the variance (gene diversity): Hhat in Wagner et al. 2005.

bylocus

A list with the semivariance estimated locus by locus

loc

A vector indicating the number of alleles by locus

unit.angle

the unit for the specification of angles

Author(s)

Jean-Pierre Rossi <ggene.package@gmail.com>

References

Wagner, H. H., R. Holderegger, S. Werth, F. Gugerli, S. E. Hoebee and C. Scheidegger. 2005. Variogram analysis of the spatial genetic structure of continuous populations using multilocus microsatellite data. Genetics 169, 1739-1752.

See Also

varioWeight, svarmap, randsvariog, fitsvariog

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
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
# omnidirectional variogram: simple computation
data(larix2300)
va <- svariog(X=larix2300, plot=TRUE)

# omnidirectional variogram: changing the distance increment
d <- distlag(dist=larix2300$coord, dmin=0, distance.lag=5)
va <- svariog(X=larix2300, uvec=d, plot=TRUE)

# omnidirectional variogram: changing the distance increment again
d <- distlag(dist=larix2300$coord, dmin=0, distance.lag=10)
va2 <- svariog(X=larix2300, uvec=d, plot=TRUE)

# plotting
plot(va$svario$u, va$svario$v)
points(va2$svario$u, va2$svario$v, col="red", pch=6)

# another example
data(larix1350)
va3 <- svariog(X=larix1350, uvec=distlag(dist=larix1350$coord, 
      dmin=0, distance.lag=10), plot=FALSE)
plot(va3$svario$u, va3$svario$v)

## Not run: 
# computing and plotting statistical envelopes
env <- randsvariog(var=va3, X=larix1350, nsim=30, 
  bounds=c(0.025, 0.975), save.sim=FALSE)
plot(env$svario$u, env$svario$v, ylim=range(env$env),
     xlab="distance", ylab="semi-variance")
points(env$svario$u, env$env[,1], type="l")
points(env$svario$u, env$env[,2], type="l")

## End(Not run)

## weighting for recurrent genotypes
data(crypho)
# compute matrix of weights
count <- genocount(X=crypho)
mat <- genoweight(X=crypho,genotyp=count$vec)
d <- distlag(dist=crypho$coord, dmin=0,distance.lag=50)
# compute variogram
wva <- varioWeight(X=crypho, weights=mat,  uvec=d)
#plot the weighted variogram
plot(wva$svario$u, wva$svario$gamma, col="black", type="b",
     ylim=range(c(wva$svario$gamma,wva$svario$v)))
#add the variogram for raw data
points(wva$svario$u, wva$svario$v, col="red", type="b")

## Computation of the directional variogram
## Not run: 
data(aniso)
va <- svariog(X=aniso, plot=TRUE)

d0_225 <- svariog(X=aniso,direction=0, tolerance=22.5, unit.angle="degrees")
d45_225 <- svariog(X=aniso,direction=45, tolerance=22.5,  unit.angle="degrees")
d90_225 <- svariog(X=aniso,direction=90, tolerance=22.5,  unit.angle="degrees")
d135_225 <- svariog(X=aniso,direction=135, tolerance=22.5,  unit.angle="degrees")

plot(va$svario$u, va$svario$v, type="b", ylim=range(c(va$svario$v,d0_225$svario$v, 
	d45_225$svario$v, d90_225$svario$v, d135_225$svario$v)), xlab="distance", 
	ylab="semivariance")

points(d0_225$svario$u, d0_225$svario$v, type="b", lty=2)
points(d45_225$svario$u, d45_225$svario$v, type="b", col="red", lty=2)
points(d90_225$svario$u, d90_225$svario$v, type="b", col="blue", lty=2)
points(d135_225$svario$u, d135_225$svario$v, type="b", col="green", lty=2)

legend("topleft", legend=c("omnidirectional", expression(0 * degree), expression(45 * degree), 
  expression(90 * degree), expression(135 * degree)), lty=c(1,2,2,2,2,2), 
	col=c("black", "black","red","blue","green"), bty="n")

## End(Not run)

## omnidirectional variogram: weighting for recurrent genotypes
data(crypho)

# compute matrix of weights
count <- genocount(X=crypho)
mat <- genoweight(X=crypho,genotyp=count$vec)
d <- distlag(dist=crypho$coord, dmin=0,distance.lag=50)

# compute variogram
wva <- varioWeight(X=crypho, weights=mat,  uvec=d)

#plot the weighted variogram
plot(wva$svario$u, wva$svario$gamma, col="black", type="b",
     ylim=range(c(wva$svario$gamma,wva$svario$v)))

#add the variogram for raw data
points(wva$svario$u, wva$svario$v, col="red", type="b")

## plot semivariance locus by locus
data(larix2300)
va <- svariog(X=larix2300)
plot(va$svario$u,va$bylocus[[1]]$gamma.by.locus, xlab="distance", ylab="semivariance",
     type="n", ylim=c(0,0.5))
cols <- rainbow(length(va$bylocus))

for(i in 1:(length(va$bylocus))){
  points(va$svario$u,va$bylocus[[i]]$gamma.by.locus, type="l", col=cols[i])
}
legend("bottomleft", legend=larix2300$locnames, col=cols, bty="n", lty=1, ncol=3)

ggene documentation built on May 2, 2019, 5:54 p.m.