cv_spline_score {drape}R Documentation

K-fold cross-validation for spline_score.

Description

K-fold cross-validation for spline_score.

Usage

cv_spline_score(x, df = 2:15, nfolds = 5L, tol = 0.001, nmax = NULL)

Arguments

x

vector of datapoints

df

vector of smoothing parameters for the non-parametric score estimator, corresponding to the effective degrees of freedom for a smoothing spline.

nfolds

integer number of cross-validation folds.

tol

numeric tolerance, minimum distance between neighbouring points, to avoid singularities.

nmax

if specified, overrides tol as maximal number of unique points.

Value

list of 5 elements: df vector, cv vector of corresponding cross-validation scores, se vector of standard error estimates, df_min cross-validation minimiser, df_1se largest smoothing parameter within CV score within one standard error of df_min.

Examples

set.seed(0)
x <- stats::rt(100, df=4)
cv_spline_score(x)

x <- stats::rlogis(500)
cvspl <- cv_spline_score(x)
cvspl$df_min

[Package drape version 0.0.1 Index]