Learn R Programming

ecospat (version 3.3)

ecospat.CCV.communityEvaluation.bin: Calculates a range of community evaluation metrics based on different thresholding techniques.

Description

The function uses the output of ecospat.CCV.modeling to calculate a range of community evaluation metrics based on a selection of thresholding techniques both for the calibration data and independent evaluation data.

Usage

ecospat.CCV.communityEvaluation.bin(ccv.modeling.data,
                                    thresholds= c('MAX.KAPPA', 'MAX.ROC','PS_SDM'),
                                    community.metrics=c('SR.deviation','Sorensen'),
                                    parallel=FALSE,
                                    cpus=4,
                                    fix.threshold=0.5,
                                    MCE=5,
                                    MEM=NULL)

Value

DataSplitTable

a matrix with TRUE/FALSE for each model run (TRUE=Calibration point, FALSE=Evaluation point)

CommunityEvaluationMetrics.CalibrationSites

a 4-dimensional array containing the community evaluation metrics for the calibartion sites of each run (NA means that the site was used for evaluation)

CommunityEvaluationMetrics.EvaluationSites

a 4-dimensional array containing the community evaluation metrics for the evaluation sites of each run (NA means that the site was used for calibaration)

PA.allSites

a 4-dimensional array of the binary prediction for all sites and runs under the different thresholding appraoches.

Arguments

ccv.modeling.data

a 'ccv.modeling.data' object returned by ecospat.CCV.modeling

thresholds

a selection of thresholds ('FIXED', 'MAX.KAPPA', 'MAX.ACCURACY', 'MAX.TSS', 'SENS_SPEC', 'MAX.ROC', 'OBS.PREVALENCE', 'AVG.PROBABILITY', 'MCE', 'PS_SDM, MEM') to be calculated and applied for the model evaluation.

community.metrics

a selection of community evaluation metrics ('SR.deviation', 'community.AUC', 'community.overprediction' ,'community.underprediction',' community.accuracy', 'community.sensitivity', 'community.specificity', 'community.kappa', 'community.tss', 'Sorensen', 'Jaccard', 'Simpson') to be calculated for each seleted thresholding technique.

parallel

should parallel computing be allowed (TRUE/FALSE)

cpus

number of cpus to use in parallel computing

fix.threshold

fixed threshold to be used. Only gets used if thresholding technique FIXED is selected.

MCE

maximum omission error (%) allowed for the thresholding. Only gets used if thresholding technique MCE is selected.

MEM

a vetor with the species richness prediction of a MEM for each site. Only needed if MEM is selected.

Author

Daniel Scherrer <daniel.j.a.scherrer@gmail.com>

Details

The function uses the probability output of the ecospat.CCV.modeling function and creates binary maps based on the selected thresholding methods. These binary maps are then used to calculate the selected community evaluation metrics both for the calibration and evaluation data of each modeling run.

References

Scherrer, D., D'Amen, M., Mateo, M.R.G., Fernandes, R.F. & Guisan , A. (2018) How to best threshold and validate stacked species assemblages? Community optimisation might hold the answer. Methods in Ecology and Evolution, in review

See Also

ecospat.CCV.createDataSplitTable; ecospat.CCV.communityEvaluation.prob

Examples

Run this code
# \donttest{
#Loading species occurence data and remove empty communities
data(ecospat.testData)
testData <- ecospat.testData[,c(24,34,43,45,48,53,55:58,60:63,65:66,68:71)]
sp.data <- testData[which(rowSums(testData)>0), sort(colnames(testData))]

#Loading environmental data
env.data <- ecospat.testData[which(rowSums(testData)>0),4:8]

#Coordinates for all sites
xy <- ecospat.testData[which(rowSums(testData)>0),2:3]

#Running all the models for all species
myCCV.Models <- ecospat.CCV.modeling(sp.data = sp.data,
                                     env.data = env.data,
                                     xy = xy,
                                     NbRunEval = 5,
                                     minNbPredictors = 10,
                                     VarImport = 3)
                                     
#Thresholding all the predictions and calculating the community evaluation metrics
myCCV.communityEvaluation.bin <- ecospat.CCV.communityEvaluation.bin(
      ccv.modeling.data = myCCV.Models, 
      thresholds = c('MAX.KAPPA', 'MAX.ROC','PS_SDM'),
      community.metrics= c('SR.deviation','Sorensen'),
      parallel = FALSE,
      cpus = 4)

# }

Run the code above in your browser using DataLab