View source: R/rdm_resistance_v11_TF_TQ.R
rdm_resistance | R Documentation |
rdm_resistance
: Reads in IBD residuals for pairs of individuals in a population, represented
as line segments connecting the pairs of individuals over a defined landscape, and then applies a novel method
(Tang et al., in review) to the residuals to calculate environmental resistance to dispersal over the landscape.
Essentially, the method splits the landscape into a grid of cells and for each cell, calculates the
resistance as the average of the IBD residuals of all line segments that intersect the cell.
rdm_resistance(IBD.res, Res_SLDF, nrows = 30, ncols = 30,
conf_intervals = 0.95, random_rep = 1000,
outputfile = "resistance_map.csv")
IBD.res |
An object of class |
Res_SLDF |
An object of class |
nrows |
Number of grid cells in each row of the raster map of resistance. The default value is 30. |
ncols |
Number of grid cells in each column of the raster map of resistance. The default value is 30. |
conf_intervals |
The coverage of the confidence interval generated for each resistance value in a grid cell, expressed as a proportion. This interval measures the uncertainty in the (observed) resistance in each cell. If a cell has no intersecting line segments or only one, then a confidence interval cannot be calculated and the cell is no longer considered for further calculation. If the confidence interval does not overlap 0, then the resistance is statistically different from 0. The default value is 0.95 (corresponding to 95% intervals). |
random_rep |
Number of random resamples of the IBD residuals used to construct the null distribution of resistances in each grid cell. For a grid cell with n intersecting line segments and n corresponding IBD residuals, a random resample consists of randomly sampling n IBD residuals from the set of all IBD residuals over the entire landscape, without replacement. If the observed resistance is above a threshold percentile of the null distribution, then the cell is considered to have a high resistance that is statistically significant. If instead the observed resistance is below another threshold percentile of the null distribution, then the cell is considered to have a low resistance that is statistically significant. The default value is 1,000. |
outputfile |
Name of the .csv file that is produced, containing resistance information in the output data frame. The default is 'resistance_map.csv'. |
A data frame with resistance information for each grid cell in the landscape with more than one
intersecting line segment. Each row corresponds to one cell, and the eight different columns refer to the
resistance, the number of intersecting line segments, the x and y coordinates specifying the location of the mid-point of the cell,
the lower and upper limits of the confidence interval for the resistance, the sign of the product of the lower and upper
limits of the confidence interval, and the percentile of the null distribution of resistances corresponding
to the observed resistance. When calculating this data, the function rdm_resistance
prints out messages
showing the current stage of calculation. There are four stages: Calculating (1) the resistances, (2) the
numbers of intersecting line segments, (3) the lower limits of the confidence intervals for the resistances,
and (4) the upper limits of the confidence intervals for the resistances.
Tang, Q., Fung, T., Rheindt, F.E. (In review). ResDisMapper: An R package for fine-scale mapping of resistance to dispersal.
IBD_res <- rdm_IBD("files/genotypes.gen", "files/coordinates.txt")
Res_SLDF <- rdm_residuals(IBD_res, "files/coordinates.txt")
rdm_resistance(IBD_res, Res_SLDF)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.