cross_validate: k-Fold cross validation for OLS model with smoothing

Description Usage Arguments Details Value

View source: R/cross_validate.R

Description

Performs cross validation using the method of Stein et al., "Ecological Moldeing from Time Series Infernece: Insight into Dynamics and Stability of Intestinal Microbiota; PLoS Comp Bio 2013.

Usage

1
cross_validate(data, k = 3, time_step = NULL, reduced = TRUE, lambda = 0)

Arguments

data

A data frame of logistic growth time series data, one column should be named "t" and one should be named "P".

k

Numeric; the number of partitions for k-fold cross validation. defaults to 3 in accordance with Stein et al's recommendation.

time_step

Numeric; also strictly positive. Can be inputted manually but defaults to the maximum time value divided by the number of time points used.

reduced

Logical; if TRUE, the carrying capacity is assumed to be 1 and only r is fitted in the model. If FALSE, both K and r are fitted.

lambda

Numeric; strictly positive. The smoothing parameter to use for Tikhonov regularization in the regression model. Defaults to zero.

Details

Stein et al. recommended performing 3-fold cross validation 10 times. This should be accomplished fairly easily with the 'replicate' command.

Value

The cross-validation error for k-fold cross validation on the model.


wz-billings/HMBGR documentation built on May 15, 2020, 5:44 a.m.