crossValFit: Cross Validation for Model Fits

View source: R/fit_model.R

crossValFitR Documentation

Cross Validation for Model Fits

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

crossValFit(
  rts,
  fit,
  vals,
  bs,
  family,
  m,
  method,
  optimizer,
  control,
  message,
  ...
)

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

control

control parameters for loess fits; see: ?loess.control

message

Option to print message indicating function progress

...

Other arguments passed to mgcv::gam.

Value

Optimal parameter value as determined by 10-fold cross validation


hhabra/metabCombiner documentation built on June 5, 2024, 5:46 a.m.