search_for_approximating_lognormal | R Documentation |
Function to search for a lognormal that comes close to meeting the constraints specified in the argument list, i.e.,
to generate roughly the given number of species but never more than the given number (tot_num_spp_after_wrapping)
to come close to the given number of species that occur on exactly 2 PUs without ever falling below that minimum value (min_num_spp_on_2_PUs)
to have the most abundant generated species have roughly the target value (target_max_abundance_ct), but never exceed the given max value (max_max_abundance).
search_for_approximating_lognormal( seed_value, tot_num_spp_after_wrapping, min_num_spp_on_2_PUs, max_max_abundance, target_max_abundance_ct, initial_meanlog, initial_sdlog, max_iterations, add_one_to_abundances, outfile )
seed_value |
random seed to pass to optim function |
tot_num_spp_after_wrapping |
number of species to generate in distribution |
min_num_spp_on_2_PUs |
minimum number of species that occur on exactly 2 patches in distribution |
max_max_abundance |
largest maximum abundance allowed in distribution |
target_max_abundance_ct |
desired maximum abundance in distribution |
initial_meanlog |
initial value of lognormal's meanlog in search for distribution |
initial_sdlog |
initial value of lognormal's sdlog in search for distribution |
max_iterations |
maximum number of iterations allowed for search |
add_one_to_abundances |
boolean flag to indicate whether to add 1 to all abundances |
outfile |
output file |
Returns the best lognormal found in the given maximum number of search iterations (max_iterations). The value returned is a structure containing the following information about the best lognormal curve found: $meanlog - the meanlog used in specifying the curve, e.g., 1.035326 $sdlog - the sdlog used in specifying the curve, e.g., 0.9283901 $score - the EF score for the curve, i.e., how well does it fit the given constraints (where smaller is better), e.g., 0.1 $abundance_data - a structure containing specifics of the curve, e.g., $abundance_data$rounded_abundances - a vector of the number of PUs each species occurs on, e.g., [1] 2 4 3 2 7 3 8 15 5 5 9 6 10 4 13 4 7 4 6 6 6 2 2 14 3 9 4 5 5 [30] 2 2 2 2 1 2 3 2 2 4 3 5 3 3 10 17 4 15 3 6 2 5 28 6 4 2 10 2 3 [59] 8 23 4 2 5 2 4 4 3 8 8 3 6 2 2 1 4 3 1 5 3 16 2 6 9 3 2 5 7 [88] 4 3 4 6 2 4 3 3 6 2 3 5 3 $abundance_data$num_spp_on_exactly_2_patches - number of species that occur on exactly 2 PUs, e.g., 22 $abundance_data$max_abundance_ct - number of PUs that the most abundant species occurs on, e.g., 28
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.