Function provides the cross-validation error for the loess curve in a manner that is amenable to optimization of the span.
# S3 method for lo2
cv(
span,
form,
data,
cost = function(y, yhat) mean((y - yhat)^2, na.rm = TRUE),
K = n,
numiter = 100,
which = c("corrected", "raw")
)
The span of the loess smoother.
The formula that identifies the model
A data frame containing the required variables.
Cost function to be passed down to loess.
Number of folds for the cross-validation
Number of times over which the cv error will be aggregated
Return raw or corrected cv error
The cross-validation error from the loess curve.