Crossvalidate_Fn: K-fold crossvalidation

View source: R/deprecated.R

Crossvalidate_FnR Documentation

K-fold crossvalidation

Description

Crossvalidate_Fn runs a k-fold crossvalidation analysis on a fitted model object

Usage

Crossvalidate_Fn(
  record_dir,
  parhat,
  original_data,
  group_i = NULL,
  kfold = 10,
  newtonsteps = 1,
  skip_finished = FALSE,
  ...
)

Arguments

record_dir,

a directory with writing privilege where the runs are stored

parhat,

a tagged list of parameters from the fitted model, e.g., as generated by parhat <- obj$env$parList() after covergence

original_data,

a tagged list of data for the VAST model

group_i,

a vector of positive integers, indicating the k-fold group for each observation (default=NULL, which generates a new group_i with even probability)

kfold,

the number of crossvalidation batches used (default=10)

newtonsteps

number of extra newton steps to take after optimization (alternative to loopnum)

skip_finished

boolean specifying whether to rerun (skip_finished==FALSE) or skip (skip_finished==TRUE) previously completed runs (Default=FALSE)

...

Additional arguments to pass to VAST::Build_TMB_Fn

Value

Results a matrix with total predictive negative log-likelihood for each crossvalidation partition, and number of crossvalidation samples for that partition


James-Thorson/FishStatsUtils documentation built on Feb. 6, 2024, 4:26 a.m.