Use k-fold cross-validation to evaluate WRTDS model fit based on supplied half-window widths.

wrtdscv(dat_in, ...)

# S3 method for default
wrtdscv(dat_in, wins, k = 10, seed_val = 123, trace = TRUE, ...)

Arguments

dat_in

input tidal or tidalmean object

...

arguments passed to wrtds or getwts, e.g., tau = 0.2 if a tidal object is used for dat_in

wins

list of input half-window widths of the order months, years, and salinity/flow, passed to getwts

k

number of folds to evaluate

seed_val

seed to keep the same dataset divisions between window width comparisons

trace

logical indicating if progress is printed in the console

Value

Overall error is the average of all errors for each fold.

Details

Default number of folds is ten. Each fold can be evaluated with multiple cores if a parallel back end is created prior to running the function (see the examples). This will greatly increase processing speed unless k is set to a small number.

Examples

if (FALSE) {

library(doParallel)
ncores <- detectCores() - 1  
registerDoParallel(cores = ncores)

# half-window widths to evaluate
# months, years, and salinity/flow
wins <- list(0.5, 10, 0.5) 

# get ocv score for k = 10
wrtdscv(tidobjmean, wins = wins)

# get ocv score k = 2, tau = 0.2 
wrtdscv(tidobj, wins = wins, tau = 0.2)
}