R/final_model.R
final_model.Rd
This function reads the models generated either by do_any
or
do_many
(i.e. one model per partition per algorithm) and
summarizes them into a final model for each species-algorithm combination.
All the final models are created from the mean of the raw continuous models
(raw_mean
). From these means, several
outputs can be created, see which_models
for details about
the final outputs available. The uncertainty between partitions, taken as
ranges (maximum - minimum values) between partitions may also be calculated.
Just as there are no silver bullets in correlative ecological niche
modeling, no method for presenting this models is always better
and these are only a subset of the possibilities.
A character string with the species name. Because species
name will be used as a directory name, avoid non-ASCII characters, spaces and
punctuation marks.
Recommendation is to adopt "Genus_species" format. See names in
example_occs
as an example
Character vector specifying which algorithms will be
processed. Note that it can have length > 1, ex. c("bioclim", "rf")
.
Defaults to NULL: if no name is given it will process all algorithms present
in the evaluation files
Logical. Whether input models should be scaled between 0 and 1
Which proportion of binary models will be kept when
creating bin_consensus
Character. Folder path where the input files are located
Character. Name of the folder to save the output files. A subfolder will be created, defaults to "final_model"
Character. The name of the subfolder with the projection. Defaults to "present" but can be set according to the other projections (i.e. to execute the function in projected models)
Which final_model
will be used? Currently it can
be:
raw_mean
Continuous model generated by the mean of the raw models (scale from 0 to 1)
raw_mean_th
Cuts the raw_mean
by the mean of the
threshold selected in mean_th_par
to make a binary model
raw_mean_cut
Recovers raw_mean
values above the
threshold selected in mean_th_par
. Generates a continuous model
above this threshold while keeping null values below it
bin_mean
The mean of the binary models, created by cutting
the raw mean models by the threshold selected in mean_th_par
.
Generates a model in a discrete scale (0 to 1 in 1/n intervals where n is
the number of partitions)
bin_consensus
The binary consensus from bin_mean
.
Parameter consensus_level
must be defined, 0.5 means a majority
consensus
A threshold that will be used to cut the raw mean models
if which_models
is set to "raw_mean_th
" or to transform the raw
mean models into binary models if which_models
is set to
"bin_consensus
". Defaults to "spec_sens
" but any dismo
threshold can be used (see function threshold
):
"kappa
", "no_omission
", "prevalence
",
"equal_spec_sens
", "sensitivity
"
Whether an uncertainty map, measured as range (max-min) should be calculated
Logical. If TRUE
, writes png files of the final
models
The sensitivity value for threshold "sensitivity
".
Defaults to 0.9
Other parameters from writeRaster
,
especially overwrite = TRUE
, when needed
Returns a data frame with final statistics of the partitions included in the final model
Writes on disk a data frame with mean statistics of the partitions included in the final model
Writes on disk a set of ecological niche models (.tif files) in the
final_dir
subfolder
If png_final = TRUE
writes .png figures in the
final_dir
subfolder
There are no references for Rd macro \insertAllCites
on this help page.
threshold
in dismo package
writeRaster
in raster package
if (FALSE) {
# run setup_sdmdata
sp <- names(example_occs)[1]
sp_coord <- example_occs[[1]]
sp_setup <- setup_sdmdata(species_name = sp,
occurrences = sp_coord,
predictors = example_vars,
clean_uni = TRUE)
# run do_any
sp_bioclim <- do_any(species_name = sp,
predictors = example_vars,
algorithm = "bioclim")
# run final_model
sp_final <- final_model(species_name = sp,
algorithms = "bioclim",
which_models = c("bin_consensus"),
consensus_level = 0.5,
overwrite = TRUE)
}