crossValFit: Cross Validation for Model Fits

Description Usage Arguments Value

View source: R/fit_model.R

Description

Helper function for fit_gam() & fit_loess(). Determines optimal value of k basis functions for Generalized Additive Model fits or span for loess fits from among user-defined choices, using a 10-fold cross validation minimizing mean squared error.

Usage

1
crossValFit(rts, fit, vals, bs, family, m, method, optimizer, loess.pars, ...)

Arguments

rts

data.frame of ordered pair retention times

fit

Either "gam" for GAM fits, or "loess" for loess fits

vals

numeric vector: k values for GAM fits, spans for loess fits. Best value chosen by 10-fold cross validation.

bs

character. Choice of spline method, either "bs" or "ps"

family

character. Choice of mgcv family; see: ?mgcv::family.mgcv

m

integer. Basis and penalty order for GAM; see ?mgcv::s

method

character. Smoothing parameter estimation method; see: ?mgcv::gam

optimizer

character. Method to optimize smoothing parameter; see: ?mgcv::gam

loess.pars

parameters for LOESS fitting; see ?loess.control

...

Other arguments passed to mgcv::gam.

Value

Optimal parameter value as determined by 10-fold cross validation


metabCombiner documentation built on Dec. 10, 2020, 2 a.m.