LLTO_cv: Leave Location Time Out Cross Validation

View source: R/AgroSoil_generic_functions.R

LLTO_cvR Documentation

Leave Location Time Out Cross Validation

Description

Assess model performance (R2, RMSE, ME) via a Leave Location Time Out Cross validation algorithm (LLTO-CV).

Usage

LLTO_cv(
  log_ = FALSE,
  targ_var,
  reg_mat_,
  pnts_cv,
  idcol,
  nfold,
  fmula,
  kan,
  month.lst_,
  pred.year_,
  method = "ranger"
)

Arguments

log_

TRUE/FALSE. Whether to noramalise observed and predicted soil moisture measurements during RMSE estimation.

targ_var

Predicted target variable

reg_mat_

Regression matrix for cross validation

pnts_cv

Object of class SpatialPoints dataframe

idcol

Column name / Station ID of in situ measurement

nfold

Numeric. Number of cross validation folds

fmula

Regression formula

kan

Character. Single month of the targetted soil moisture prediction year. Values are abbreviated month name. E.g. "Jan", "Mar", "Oct".

month.lst_

Vector or a list. All months of the targetted soil moisture prediction year.

pred.year_

Numeric. Single soil moisture prediction year

method

Algorithm for LLTO. Default value is "ranger". Other option is "ensemble" for coupling Random forest (ranger) and Gradient boost (Xgboost) algorithms.

Value

A list with CV resutls (Observed, predicted and performance metrics)

Examples

library(raster)
library(caret)
library(ranger)
library(DescTools)

out <- LLTO_cv(log_, targ_var, reg_mat_, pnts_cv, idcol, nfold, fmula, kan, month.lst_, pred.year_, method)

kanj241/agrosoil documentation built on March 25, 2022, 12:22 a.m.