t_oos_mc: Time-wise Monte Carlo

Description Usage Arguments Value

View source: R/methods.R

Description

Performs a time-wise Monte Carlo experiment where split points are randomly chosen and a window of previous observations are used for training, with a window of following observations used for testing.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
t_oos_mc(
  data,
  tr.perc,
  ts.perc,
  nreps,
  FUN,
  form,
  time = "time",
  site_id = "site",
  .keepTrain = TRUE,
  .parallel = FALSE,
  .verbose = ifelse(.parallel, FALSE, TRUE),
  ...
)

Arguments

data

full dataset

tr.perc

percentage of data used for training. Remaining will be used for testing

ts.perc

percentage of data used for testing

nreps

number of repetitions/split-points in experiment

FUN

function with arguments

  • train training set

  • test testing set

  • time column name of time-stamps

  • site_id column name of location identifiers

  • form a formula for model learning

  • ... other arguments

form

a formula for model learning

time

column name of time-stamp in data. Default is "time"

site_id

column name of location identifier in data. Default is "site_id"

.keepTrain

if TRUE (default), instead of the results of FUN being directly returned, a list is created with both the results and a data.frame with the time and site identifiers of the observations used in the training step.

.parallel

Boolean indicating whether each fold should be run in parallel

.verbose

if TRUE, prints information about progress of the experiment. Default FALSE unless experiment is run in parallel

...

other arguments to FUN

Value

If keepTrain is TRUE, a list where each slot corresponds to one repetition or fold, containing a list with slots results containing the results of FUN, and train containing a data.frame with the time and site_id identifiers of the observations used in the training step. Usually, the results of FUN is a data.frame with location identifier site_id, time-stamp time, true values trues and the workflow's predictions preds.


mrfoliveira/STEvaluation-MDPI2021 documentation built on Dec. 21, 2021, 10:07 p.m.