Description Usage Arguments Value Examples
Calculates resistance distances associated with a parameterized conductance surface across a grid of parameter values.
1 2 3 4 5 6 7 8 | radish_distance(
theta,
formula,
data,
conductance_model = radish::loglinear_conductance,
conductance = TRUE,
covariance = FALSE
)
|
theta |
A matrix of dimension (grid size) x (number of parameters) |
formula |
A formula with the name of a matrix of observed genetic distances on the lhs, and covariates in the creation of |
data |
An object of class |
conductance_model |
A function of class |
conductance |
If |
covariance |
If |
An object of class radish_grid
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(raster)
data(melip)
covariates <- raster::stack(list(altitude = raster::scale(melip.altitude),
forestcover = raster::scale(melip.forestcover)))
theta <- as.matrix(expand.grid(forestcover=seq(-1,1,length.out=21),
altitude=seq(-1,1,length.out=21)))
distances <- radish_distance(theta, ~forestcover + altitude,
surface, radish::loglinear_conductance)
ibd <- which(theta[,1] == 0 & theta[,2] == 0)
plot(distances$distance[,,ibd], melip.Fst, pch = 19,
xlab = "Null resistance distance (IBD)", ylab = "Fst")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.