R/eval_rare_richness_importance.R
eval_rare_richness_importance.Rd
Calculate importance scores for planning units selected in a solution using rarity weighted richness scores (based on Williams et al. 1996). This method is only recommended for large-scaled conservation planning exercises (i.e., more than 100,000 planning units) where importance scores cannot be calculated using other methods in a feasible period of time. This is because rarity weighted richness scores cannot (i) account for the cost of different planning units, (ii) account for multiple management zones, and (iii) identify truly irreplaceable planning units--- unlike the replacement cost metric which does not suffer any of these limitations.
eval_rare_richness_importance(x, solution, ...)
# S4 method for ConservationProblem,numeric
eval_rare_richness_importance(x, solution, rescale, ...)
# S4 method for ConservationProblem,matrix
eval_rare_richness_importance(x, solution, rescale, ...)
# S4 method for ConservationProblem,data.frame
eval_rare_richness_importance(x, solution, rescale, ...)
# S4 method for ConservationProblem,Spatial
eval_rare_richness_importance(x, solution, rescale, ...)
# S4 method for ConservationProblem,sf
eval_rare_richness_importance(x, solution, rescale, ...)
# S4 method for ConservationProblem,Raster
eval_rare_richness_importance(x, solution, rescale, ...)
problem()
(i.e., ConservationProblem
) object.
numeric
, matrix
, data.frame
,
Raster
, Spatial
,
or sf::sf()
object.
The argument should be in the same format as the planning unit cost
data in the argument to x
.
See the Solution format section for more information.
not used.
logical
flag indicating if replacement cost
values---excepting infinite (Inf
) and zero values---should be
rescaled to range between 0.01 and 1. Defaults to TRUE
.
A numeric
, matrix
, data.frame
RasterLayer
, Spatial
,
or sf::sf()
object containing the importance scores for each planning
unit in the solution. Specifically, the returned object is in the
same format as the planning unit data in the argument to x
.
Rarity weighted richness scores are calculated using the following terms. Let \(I\) denote the set of planning units (indexed by \(i\)), let \(J\) denote the set of conservation features (indexed by \(j\)), let \(r_{ij}\) denote the amount of feature \(j\) associated with planning unit \(i\), and let \(m_j\) denote the maximum value of feature \(j\) in \(r_{ij}\) in all planning units \(i \in I\). To calculate the rarity weighted richness (RWR) for planning unit \(k\):
$$ \mathit{RWR}_{k} = \sum_{j}^{J} \frac{ \frac{r_{ik}}{m_j} }{ \sum_{i}^{I}r_{ij}} $$
Broadly speaking, the argument to solution
must be in the same format as
the planning unit data in the argument to x
.
Further details on the correct format are listed separately
for each of the different planning unit data formats:
x
has numeric
planning unitsThe argument to 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 the argument to x
. Additionally, any planning units missing
cost (NA
) values should also have missing (NA
) values in the
argument to solution
.
x
has matrix
planning unitsThe argument to 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 the argument to x
. Additionally, any planning units
missing cost (NA
) values for a particular zone should also have a
missing (NA
) values in the argument to solution
.
x
has Raster
planning unitsThe argument to solution
be a Raster
object where different grid cells (pixels) 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 the argument to x
. Additionally,
any planning units missing cost (NA
) values for a particular zone
should also have missing (NA
) values in the argument to solution
.
x
has data.frame
planning unitsThe argument to 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 missing cost
(NA
) values for a particular zone should also have missing (NA
)
values in the argument to solution
.
x
has Spatial
planning unitsThe argument to solution
must be a Spatial
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
Spatial
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, the argument to solution
must also have the same
coordinate reference system as the planning unit data.
Furthermore, any planning units missing cost
(NA
) values for a particular zone should also have missing (NA
)
values in the argument to solution
.
x
has sf::sf()
planning unitsThe argument to 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, the argument to solution
must also have the same
coordinate reference system as the planning unit data.
Furthermore, any planning units missing cost
(NA
) values for a particular zone should also have missing (NA
)
values in the argument to solution
.
Williams P, Gibbons D, Margules C, Rebelo A, Humphries C, and Pressey RL (1996) A comparison of richness hotspots, rarity hotspots and complementary areas for conserving diversity using British birds. Conservation Biology, 10: 155--174.
See importance for an overview of all functions for evaluating the importance of planning units selected in a solution.
Other importances:
eval_ferrier_importance()
,
eval_replacement_importance()
# \dontrun{
# seed seed for reproducibility
set.seed(600)
# load data
data(sim_pu_raster, sim_pu_sf, sim_features)
# create minimal problem with raster planning units
p1 <- problem(sim_pu_raster, sim_features) %>%
add_min_set_objective() %>%
add_relative_targets(0.1) %>%
add_binary_decisions() %>%
add_default_solver(gap = 0, verbose = FALSE)
# solve problem
s1 <- solve(p1)
# print solution
print(s1)
#> class : RasterLayer
#> dimensions : 10, 10, 100 (nrow, ncol, ncell)
#> resolution : 0.1, 0.1 (x, y)
#> extent : 0, 1, 0, 1 (xmin, xmax, ymin, ymax)
#> crs : NA
#> source : memory
#> names : layer
#> values : 0, 1 (min, max)
#>
# plot solution
plot(s1, main = "solution", axes = FALSE, box = FALSE)
# calculate importance scores
rwr1 <- eval_rare_richness_importance(p1, s1)
# print importance scores
print(rwr1)
#> class : RasterLayer
#> dimensions : 10, 10, 100 (nrow, ncol, ncell)
#> resolution : 0.1, 0.1 (x, y)
#> extent : 0, 1, 0, 1 (xmin, xmax, ymin, ymax)
#> crs : NA
#> source : memory
#> names : rwr
#> values : 0, 1 (min, max)
#>
# plot importance scores
plot(rwr1, main = "rarity weighted richness", axes = FALSE, box = FALSE)
# create minimal problem with polygon (sf) planning units
p2 <- problem(sim_pu_sf, sim_features, cost_column = "cost") %>%
add_min_set_objective() %>%
add_relative_targets(0.05) %>%
add_binary_decisions() %>%
add_default_solver(gap = 0, verbose = FALSE)
# solve problem
s2 <- solve(p2)
# print solution
print(s2)
#> Simple feature collection with 90 features and 4 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 0 ymin: 0 xmax: 1 ymax: 1
#> CRS: NA
#> First 10 features:
#> cost locked_in locked_out solution_1 geometry
#> 1 215.8638 FALSE FALSE 0 POLYGON ((0 1, 0.1 1, 0.1 0...
#> 2 212.7823 FALSE FALSE 0 POLYGON ((0.1 1, 0.2 1, 0.2...
#> 3 207.4962 FALSE FALSE 0 POLYGON ((0.2 1, 0.3 1, 0.3...
#> 4 208.9322 FALSE TRUE 0 POLYGON ((0.3 1, 0.4 1, 0.4...
#> 5 214.0419 FALSE FALSE 0 POLYGON ((0.4 1, 0.5 1, 0.5...
#> 6 213.7636 FALSE FALSE 0 POLYGON ((0.5 1, 0.6 1, 0.6...
#> 7 210.4612 FALSE FALSE 0 POLYGON ((0.6 1, 0.7 1, 0.7...
#> 8 211.0424 FALSE TRUE 0 POLYGON ((0.7 1, 0.8 1, 0.8...
#> 9 210.3878 FALSE FALSE 0 POLYGON ((0.8 1, 0.9 1, 0.9...
#> 10 204.3971 FALSE FALSE 0 POLYGON ((0.9 1, 1 1, 1 0.9...
# plot solution
plot(s2[, "solution_1"], main = "solution")
# calculate importance scores
rwr2 <- eval_rare_richness_importance(p2, s2[, "solution_1"])
# plot importance scores
plot(rwr2, main = "rarity weighted richness")
# }