Faciliates model cross-validation using k-fold or leave-one-out cross validation.

pr_cross_validate(
  k = 10,
  cv_seed = 1234,
  cv_set = NULL,
  ncores = 1,
  random_seeds = c(1, 12, 40),
  models = c("LIN", "TT", "TTs", "PTT", "PTTs", "M1", "M1s", "AT", "SQ", "SQb", "SM1",
    "SM1b", "PA", "PAb", "PM1", "PM1b", "UN", "UM1", "SGSI", "AGSI"),
  data = phenor::phenocam_DB,
  method = "GenSA",
  control = list(max.call = 5000, temperature = 10000),
  par_ranges = sprintf("%s/extdata/parameter_ranges.csv", path.package("phenor"))
)

Arguments

k

perform k-fold cross validation (set k=0 to perform a leave-one-out cross-validation)

cv_seed

a vector with random seeds for cross validation (to shuffle the input data)

cv_set

(optional) use custom sets cross validation (requires a list of vectors the indices of the data used for validation (hold-out), the remaining data will be used for calibration)

ncores

number of cores to use for crossvalidation (requires 'doParallel' and 'foreach' library)

random_seeds

a vector with random seeds for optimization replicates

models

list of models to compare

data

which standard or custom dataset to use

method

which optimization method to use, GenSA or rgenoud (default = GenSA)

control

additional optimization control parameters (default = list(max.call = 5000, temperature = 10000))

par_ranges

location of the parameter ranges of the models

Examples


if (FALSE) {
 pr_cross_validate(k=10,CV_seed = 123, models =  c("LIN","TT","PTT") ,
 data = phenocam_DB[c(1:10)])

# will return the data of each validation and some summarizing statistics
}