| eval_asym_connectivity_summary | R Documentation |
Calculate the connectivity held within a solution to a conservation planning problem. This summary statistic evaluates the connectivity of a solution using pair-wise connectivity values between combinations of planning units. It is specifically designed for asymmetric connectivity data.
## S4 method for signature 'GenericConservationProblem,ANY,ANY,matrix'
eval_asym_connectivity_summary(x, solution, zones, data)
## S4 method for signature 'GenericConservationProblem,ANY,ANY,Matrix'
eval_asym_connectivity_summary(x, solution, zones, data)
## S4 method for signature 'GenericConservationProblem,ANY,ANY,data.frame'
eval_asym_connectivity_summary(x, solution, zones, data)
## S4 method for signature 'GenericConservationProblem,ANY,ANY,dgCMatrix'
eval_asym_connectivity_summary(x, solution, zones, data)
## S4 method for signature 'GenericConservationProblem,ANY,ANY,array'
eval_asym_connectivity_summary(x, solution, zones, data)
x |
|
solution |
|
zones |
|
data |
|
This summary statistic is comparable to the Connectivity metric
reported by the
Marxan software (Ball et al. 2009).
It is calculated using the same equations used to penalize solutions
with asymmetric connectivity data
(i.e., add_asym_connectivity_penalties()).
Specifically, it is calculated as the sum of the connectivity
values (per data) that correspond pairs of planning
units, wherein one planning unit is selected by the solution
and the other planning unit is not selected by solution.
A tibble::tibble() object describing the connectivity of the
solution. It contains the following columns.
character description of the summary statistic.
The statistic associated with the "overall" value
in this column is calculated using the entire solution
(including all management zones if x has multiple zones).
If x has multiple management zones, then summary statistics
are also provided for each zone separately
(indicated using zone names).
numeric connectivity value.
Greater values correspond to solutions associated with greater
connectivity.
Thus conservation planning exercises typically prefer solutions
with greater values.
Broadly speaking, solution must be in the same format as
the planning unit data in x.
Further details on the correct format are listed separately
for each of the different planning unit data formats.
x has numeric planning unitsHere solution must be a
numeric vector with each element corresponding to a different planning
unit. It should have the same number of planning units as those
in x. Additionally, any planning units with missing
cost (NA) values should also have missing (NA) values in the
solution.
x has matrix planning unitsHere solution must be a
matrix vector with each row corresponding to a different planning
unit, and each column correspond to a different management zone.
It should have the same number of planning units and zones
as those in x. Additionally, any planning units with
missing cost (NA) values for a particular zone should also have a
missing (NA) values in solution.
x has terra::rast() planning unitsHere solution
be a terra::rast() object where different cells correspond
to different planning units and layers correspond to
a different management zones. It should have the same dimensionality
(rows, columns, layers), resolution, extent, and coordinate reference
system as the planning units in x. Additionally,
any planning units with missing cost (NA) values for a particular zone
should also have missing (NA) values in solution.
x has data.frame planning unitsHere solution must
be a data.frame with each column corresponding to a different zone,
each row corresponding to a different planning unit, and cell values
corresponding to the solution value. This means that if a data.frame
object containing the solution also contains additional columns, then
these columns will need to be subsetted prior to using this function
(see below for example with sf::sf() data).
Additionally, any planning units with missing cost
(NA) values for a particular zone should also have missing (NA)
values in solution.
x has sf::sf() planning unitsHere solution must be
a sf::sf() object with each column corresponding to a different
zone, each row corresponding to a different planning unit, and cell values
corresponding to the solution value. This means that if the
sf::sf() object containing the solution also contains additional
columns, then these columns will need to be subsetted prior to using this
function (see below for example).
Additionally, solution must also have the same
coordinate reference system as the planning unit data.
Furthermore, any planning units with missing cost
(NA) values for a particular zone should also have missing (NA)
values in solution.
The following formats can be used to specify data.
data as a matrix/Matrix objectHere rows and columns correspond to different planning units and cell
values denote the strength of connectivity between two planning units.
Cells that occur along the matrix diagonal are treated as weights which
indicate that planning units are more desirable in the solution.
With this format, zones can be used to control
the strength of connectivity between planning units in different zones.
Note that the default for zones is to treat planning units
allocated to different zones as having zero connectivity.
data as a data.frame objectHere rows correspond to a pair of planning units and columns
provide information about each pair of planning units.
In particular, data must have the columns:
"id1", "id2", and "boundary".
The "id1" and "id2" columns contain
identifiers (indices) for a pair of planning units, and the "boundary"
column contains the strength of connectivity between them
(following the Marxan format).
If x has multiple zones, then the
"zone1" and "zone2" columns can optionally be provided to manually
specify the connectivity values between planning units when they are
allocated to particular zones. Note that if the "zone1" and
"zone2" columns are present, then zones must be
NULL.
data as an array objectHere a four-dimension array is used to specify connectivity data,
where cell values indicate the strength of connectivity between planning
units when they are assigned to specific management zones. The first two
dimensions (i.e., rows and columns) indicate the strength of
connectivity between different planning units and the second two
dimensions indicate the different management zones. Thus
the data[1, 2, 3, 4] indicates the strength of
connectivity between planning unit 1 and planning unit 2 when planning
unit 1 is assigned to zone 3 and planning unit 2 is assigned to zone 4.
Ball IR, Possingham HP, and Watts M (2009) Marxan and relatives: Software for spatial conservation prioritisation in Spatial conservation prioritisation: Quantitative methods and computational tools. Eds Moilanen A, Wilson KA, and Possingham HP. Oxford University Press, Oxford, UK.
See summaries for an overview of all functions for summarizing solutions.
Also, see add_asym_connectivity_penalties() to penalize solutions with low
asymmetric connectivity.
Other functions for summarizing solutions:
eval_boundary_summary(),
eval_connectivity_summary(),
eval_cost_summary(),
eval_feature_representation_summary(),
eval_n_summary(),
eval_objective_summary(),
eval_target_coverage_summary()
# set seed for reproducibility
set.seed(500)
# load data
sim_pu_polygons <- get_sim_pu_polygons()
sim_features <- get_sim_features()
sim_zones_pu_polygons <- get_sim_zones_pu_polygons()
sim_zones_features <- get_sim_zones_features()
# build minimal conservation problem with polygon data
p1 <-
problem(sim_pu_polygons, sim_features, cost_column = "cost") %>%
add_min_set_objective() %>%
add_relative_targets(0.1) %>%
add_binary_decisions() %>%
add_default_solver(verbose = FALSE)
# solve the problem
s1 <- solve(p1)
# print solution
print(s1)
# plot solution
plot(s1[, "solution_1"])
# simulate connectivity matrix
# here, we will generate connectivity values randomly
# between all pairs of planning units
acm1 <- matrix(
runif(nrow(sim_pu_polygons) ^ 2),
nrow = nrow(sim_pu_polygons)
)
# calculate connectivity associated with the solution
r1 <- eval_asym_connectivity_summary(p1, s1[, "solution_1"], data = acm1)
print(r1)
# build multi-zone conservation problem with polygon data
p2 <-
problem(
sim_zones_pu_polygons, sim_zones_features,
cost_column = c("cost_1", "cost_2", "cost_3")
) %>%
add_min_set_objective() %>%
add_relative_targets(matrix(runif(15, 0.1, 0.2), nrow = 5, ncol = 3)) %>%
add_binary_decisions() %>%
add_default_solver(verbose = FALSE)
# solve the problem
s2 <- solve(p2)
# print solution
print(s2)
# create new column representing the zone id that each planning unit
# was allocated to in the solution
s2$solution <- category_vector(
s2[, c("solution_1_zone_1", "solution_1_zone_2", "solution_1_zone_3")]
)
s2$solution <- factor(s2$solution)
# plot solution
plot(s2[, "solution"])
# simulate asymmetric connectivity matrix
acm2 <- matrix(
runif(nrow(sim_zones_pu_polygons) ^ 2),
nrow = nrow(sim_zones_pu_polygons)
)
# calculate connectivity associated with the solution
r2 <- eval_asym_connectivity_summary(
p2,
s2[, c("solution_1_zone_1", "solution_1_zone_2", "solution_1_zone_3")],
data = acm2
)
print(r2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.