Conservation planning often requires the comparison of the outputs of the solutions of different conservation problems.
One way to compare solutions is by correlating the solutions using Cohen's Kappa.
splnr_get_kappaCorrData()
takes a list of prioritizr
solutions to perform the Cohen's Kappa correlation between the solution.
The resulting correlation matrix is symmetrical along the main diagonal and contains Cohen's Kappa of pairwise correlation between the solutions.
The main diagonal should always be 1. The correlation matrix obtained from this function can be passed onto splnr_plot_corrMat()
.
Examples
# 30 % target for problem/solution 1
dat_problem <- prioritizr::problem(dat_species_bin %>% dplyr::mutate(Cost = runif(n = dim(.)[[1]])),
features = c("Spp1", "Spp2", "Spp3", "Spp4", "Spp5"),
cost_column = "Cost"
) %>%
prioritizr::add_min_set_objective() %>%
prioritizr::add_relative_targets(0.3) %>%
prioritizr::add_binary_decisions() %>%
prioritizr::add_default_solver(verbose = FALSE)
dat_soln <- dat_problem %>%
prioritizr::solve.ConservationProblem()
# 50 % target for problem/solution 2
dat_problem2 <- prioritizr::problem(
dat_species_bin %>%
dplyr::mutate(Cost = runif(n = dim(.)[[1]])),
features = c("Spp1", "Spp2", "Spp3", "Spp4", "Spp5"),
cost_column = "Cost"
) %>%
prioritizr::add_min_set_objective() %>%
prioritizr::add_relative_targets(0.5) %>%
prioritizr::add_binary_decisions() %>%
prioritizr::add_default_solver(verbose = FALSE)
dat_soln2 <- dat_problem2 %>%
prioritizr::solve.ConservationProblem()
corrMat <- splnr_get_kappaCorrData(list(dat_soln, dat_soln2), name_sol = c("soln1", "soln2"))
#> New names:
#> • `soln1` -> `soln1...1`
#> • `soln1` -> `soln1...2`
#> New names:
#> • `soln2` -> `soln2...1`
#> • `soln2` -> `soln2...2`
#> New names:
#> • `` -> `...1`
#> • `` -> `...2`