crossval.regmodel {mdatools}R Documentation

Cross-validation of a regression model

Description

Does cross-validation of a regression model

Usage

crossval.regmodel(obj, x, y, cv, cal.fun, pred.fun, cv.scope = "local")

Arguments

obj

a regression model (object of class regmodel)

x

a matrix with x values (predictors from calibration set)

y

a matrix with y values (responses from calibration set)

cv

number of segments (if cv = 1, full cross-validation will be used)

cal.fun

reference to function for model calibration

pred.fun

reference to function for getting predicted y-values (see description)

cv.scope

scope for center/scale operations inside CV loop: 'global' — using globally computed mean and std or 'local' — recompute new for each local calibration set.

Value

object of class plsres with results of cross-validation

Function 'pred.fun' must take four agruments: autoscaled x-values, array with regression coefficients, vectors for centring and scaling of y-values (if used). The function must return predicted y-values in original units (unscaled and uncentered).


[Package mdatools version 0.14.1 Index]