convert_cd {graph4lg} | R Documentation |
Fit a model to convert cost-distances into Euclidean distances
Description
The function fits a model to convert cost-distances into Euclidean distances as implemented in Graphab software.
Usage
convert_cd(
mat_euc,
mat_ld,
to_convert,
method = "log-log",
fig = TRUE,
line_col = "black",
pts_col = "#999999"
)
Arguments
mat_euc |
A symmetric |
mat_ld |
A symmetric |
to_convert |
A numeric value or numeric vector with Euclidean distances to convert into cost-distances. |
method |
A character string indicating the method used to fit the model.
|
fig |
Logical (default = TRUE) indicating whether a figure is plotted |
line_col |
(if 'fig = TRUE') Character string indicating the color used to plot the line (default: "blue"). It must be a hexadecimal color code or a color used by default in R. |
pts_col |
(if 'fig = TRUE') Character string indicating the color used to plot the points (default: "#999999"). It must be a hexadecimal color code or a color used by default in R. |
Details
IDs in 'mat_euc' and 'mat_ld' must be the same and refer to the same
sampling site or populations, and both matrices must be ordered
in the same way.
Matrix of Euclidean distance 'mat_euc' can be computed using the function
mat_geo_dist
.
Matrix of landscape distance 'mat_ld' can be computed using the function
mat_cost_dist
.
Before the log calculation, 0 distance values are converted into 1,
so that they are 0 after this calculation.
Value
A list of output (converted values, estimated parameters, R2) and optionally a ggplot2 object to plot
Author(s)
P. Savary
References
FoltĂȘte J, Clauzel C, Vuidel G (2012). “A software tool dedicated to the modelling of landscape networks.” Environmental Modelling & Software, 38, 316–327.
Examples
data("data_tuto")
mat_ld <- data_tuto[[2]][1:10, 1:10] * 1000
mat_euc <- data_tuto[[1]][1:10, 1:10] * 50000
to_convert <- c(30000, 40000)
res <- convert_cd(mat_euc = mat_euc,
mat_ld = mat_ld,
to_convert = to_convert, fig = FALSE)