check_for_imperfect_wrap: See whether wrapping species fully contain base species

check_for_imperfect_wrapR Documentation

See whether wrapping species fully contain base species

Description

When wrapping a species distribution around a Xu biodiversity problem, the optimizer may have stopped before finding a distribution that fully encloses the base distribution, i.e., the wrapping distribution has fewer species that occur on exactly 2 patches than the base distribution has. In that case, the freq entry in the wrapping abundance distribution will be negative. If the allow_imperfect_wrap flag is set to TRUE, then set that histogram value to be 0 instead of the negative value, otherwise, it's a fatal error and the program should stop.

Usage

check_for_imperfect_wrap(
  final_wrapped_extra_spp_abund_hist,
  allow_imperfect_wrap
)

Arguments

final_wrapped_extra_spp_abund_hist

data frame showing the number of species to be added for each occurrence count, e.g., how many new species to add that occur on exactly 2 patches, exactly 3 patches, etc.

allow_imperfect_wrap

boolean indicating whether the proposed wrapping distribution is allowed to not fully enclose the base distribution

Details

Note that the reason the value gets set to 0 instead of to the number of species on 2 patches in the base distribution is that the histogram is representing the total number of Extra species to be added that occur on exactly 2 patches rather than the total number of species occurring on 2 patches in the entire combined distribution.

Value

list containing the final wrapping abundance histogram and a boolean flag indicating whether the wrap is imperfect or not


langfob/bdpg documentation built on Dec. 8, 2022, 5:33 a.m.