Learn R Programming

ecospat (version 4.1.1)

ecospat.CCV.createDataSplitTable: Creates a DataSplitTable for usage in ecospat.ccv.modeling.

Description

Creates a DataSplitTable with calibration and evaluation data either for cross-validation or repeated split sampling at the community level (i.e., across all species).

Usage

ecospat.CCV.createDataSplitTable(NbRunEval, 
                                 DataSplit,
                                 validation.method,
                                 NbSites,
                                 sp.data=NULL,
                                 minNbPresences=NULL,
                                 minNbAbsences=NULL,
                                 maxNbTry=1000)

Value

DataSplitTable

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

Arguments

NbRunEval

number of cross-validation or split sample runs

DataSplit

proportion (%) of sites used for model calibration

validation.method

the type of DataSplitTable that should be created. Must be either 'cross-validation' or 'split-sample'

NbSites

number of total sites available. Is ignored if sp.data is provided.

sp.data

a data.frame where the rows are sites and the columns are species (values 1,0)

minNbPresences

the desired minimum number of Presences required in each run

minNbAbsences

the desired minimum number of Absences required in each run

maxNbTry

number of random tries allowed to create a fitting DataSplitTable

Author

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

Details

If a sp.data data.frame with species presences and absences is provided the function tries to create a DataSplitTable which ensures that the maximum possible number of species can be modelled (according to the specified minimum presences and absences.)

See Also

ecospat.CCV.modeling

Examples

Run this code
# \donttest{
#Creating a DataSplitTable for 200 sites, 25 runs with an 
#80/20 calibration/evaluation cross-validation

DataSplitTable <- ecospat.CCV.createDataSplitTable(NbSites = 200, 
                                                   NbRunEval=25, 
                                                   DataSplit=80, 
                                                   validation.method='cross-validation')
                                                   
#Loading species occurence data and remove empty communities
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))]

#Creating a DataSplitTable based on species data directly
DataSplitTable <- ecospat.CCV.createDataSplitTable(NbRunEval = 20,
                                                   DataSplit = 70,
                                                   validation.method = "cross-validation",
                                                   NbSites = NULL,
                                                   sp.data = sp.data, 
                                                   minNbPresence = 15, 
                                                   minNbAbsences = 15, 
                                                   maxNbTry = 250)
# }

Run the code above in your browser using DataLab