| nei_coval {rNeighborGWAS} | R Documentation |
Calculating neighbor genotypic identity
Description
A function to calculate neighbor genotypic identity, with a given reference scale and a degree of distance decay.
Usage
nei_coval(
geno,
smap,
scale,
alpha = Inf,
kernel = c("exp", "gaussian"),
grouping = rep(1, nrow(smap)),
n_core = 1L
)
Arguments
geno |
An individual x marker matrix. Bialleles (i.e., A or a) must be converted into -1 or 1 digit. |
smap |
A matrix showing a spatial map for individuals. The first and second column include spatial points along an x-axis and y-axis, respectively. |
scale |
A numeric scalar indicating the maximum spatial distance between a focal individual and neighbors to define neighbor effects. |
alpha |
An option to set a distance decay coefficient |
kernel |
An option to select either |
grouping |
A positive integer vector assigning each individual to a group. This argument can be useful when a "smap" contains different experimental replicates. Default setting means that all individuals are belong to a single group. |
n_core |
No. of cores for a multi-core computation. This does not work for Windows OS. Default is a single-core computation. |
Details
Default setting is recommended for alpha and kernel arguments unless spatial distance decay of neighbor effects needs to be modeled.
If alpha is not Inf, output variables are weighted by a distance decay from a focal individual to scale.
For the type of dispersal kernel in the distance decay, we can choose a negative exponential or Gaussian kernel as a fat-tailed or thin-tailed distribution, respectively.
See Nathan et al. (2012) for detailed characteristics of the two dispersal kernels.
Value
A numeric matrix for neighbor covariates, with no. of individuals x markers.
Author(s)
Yasuhiro Sato (sato.yasuhiro.36c@kyoto-u.jp)
References
Nathan R, Klein E, Robledo-Arnuncio JJ, Revilla E. (2012) Dispersal kernels: review. In: Clobert J, Baguette M, Benton TG, Bullock JM (Eds.), Dispersal Ecology and Evolution. Oxford University Press, pp.186-210.
Examples
set.seed(1)
g <- matrix(sample(c(-1,1),100*1000,replace = TRUE),100,1000)
gmap <- cbind(c(rep(1,nrow(g)/2),rep(2,nrow(g)/2)),c(1:ncol(g)))
x <- runif(nrow(g),1,100)
y <- runif(nrow(g),1,100)
smap <- cbind(x,y)
grouping <- c(rep(1,nrow(g)/2), rep(2,nrow(g)/2))
g_nei <- nei_coval(g,smap,44,grouping = grouping)