View source: R/ellipsoid_selection.R
ellipsoid_omr | R Documentation |
Compute the omission rate of ellipspoid models
ellipsoid_omr(
env_data,
env_test = NULL,
env_bg,
cf_level,
mve = TRUE,
proc = FALSE,
proc_iter = 100,
sub_sample = FALSE,
sub_sample_size = 10000,
rseed = TRUE
)
env_data |
A data frame with the environmental data. |
env_test |
A data frame with the environmental testing data. The default is NULL if given the selection process will show the p-value of a binomial test. |
env_bg |
Environmental data to compute the approximated prevalence of the model. The data should be a sample of the environmental layers of the calibration area. |
cf_level |
Proportion of points to be included in the ellipsoids. This parameter is equivalent to the error (E) proposed by Peterson et al. (2008). |
mve |
A logical value. If TRUE a minimum volume ellipsoid will be computed using
the function |
proc |
Logical if TRUE a partial roc test will be run. |
proc_iter |
Numeric. The total number of iterations for the partial ROC bootstrap. |
sub_sample |
Logical. Indicates whether the pROC test should run using a subsample of size sub_sample_size. It is recommended for big rasters |
sub_sample_size |
Numeric. Size of the sample to be used for computing pROC values. |
rseed |
Logical. Whether or not to set a random seed for partial roc bootstrap. Default TRUE. |
A data.frame with 5 columns: i) "fitted_vars" the names of variables that were fitted; ii) "om_rate" omission rates of the model; iii) "bg_prevalence" approximated prevalence of the model see details section.
## Not run:
# Bioclimatic layers path
wcpath <- list.files(system.file("extdata/bios",
package = "ntbox"),
pattern = ".tif$",full.names = TRUE)
# Bioclimatic layers
wc <- raster::stack(wcpath)
# Occurrence data for the giant hummingbird (Patagona gigas)
pg <- utils::read.csv(system.file("extdata/p_gigas.csv",
package = "ntbox"))
# Split occs in train and test
pgL <- base::split(pg,pg$type)
pg_train <- pgL$train
pg_test <- pgL$test
# Environmental data for training and testing
pg_etrain <- raster::extract(wc,pg_train[,c("longitude",
"latitude")],
df=TRUE)
pg_etrain <- pg_etrain[,-1]
pg_etest <- raster::extract(wc,pg_test[,c("longitude",
"latitude")],
df=TRUE)
pg_etest <- pg_etest[,-1]
# Non-correlated variables
env_varsL <- ntbox::correlation_finder(cor(pg_etrain),
threshold = 0.8,
verbose = F)
env_vars <- env_varsL$descriptors
env_bg <- raster::sampleRandom(wc,10000)
ellip_eval <- ellipsoid_omr(env_data=pg_etrain[,c("bio01","bio07","bio12")],
env_test=pg_etest[,c("bio01","bio07","bio12")],
env_bg = env_bg[,c("bio01","bio07","bio12")],
cf_level = 0.97,
mve=TRUE,proc=TRUE,
proc_iter=100,rseed=TRUE)
print(ellip_eval)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.