Cross-validation function for fusedanova method.

Share:

Description

Function that computes K-fold cross-validated error of a fusedanova fit. Possibility to perform V times the whole K-fold CV to average the error and reduce the reduce the CV standard error around the minimum.

Usage

1
2
cv.fa(x, class, K = 10, folds = split(sample(1:length(class)), rep(1:K,
  length = length(class))), lambdalist = NULL, V = 1, verbose = TRUE, ...)

Arguments

x

matrix whose rows represent individuals and columns independant variables.

class

vector or factor giving the class of each individual.

K

integer indicating the number of folds. Default is 10.

V

integer indicating the number of times the K folds CV will be averaged. Default is 1 (no averaging).

verbose

boolean for verbose mode. Default is TRUE.

folds

list of K vectors that describes the folds to use for the cross-validation. By default, the folds are randomly sampled with the specified K. The same folds are used for each values of lambdalist.

lambdalist

list of lambda penalty parameters used in the cross validation. By default, lambdalist is NULL and calculated using the maximum lambda and the parameter nlambda.

...

list of additional parameters to overwrite the defaults of the fitting procedure. See the corresponding documentation (fusedanova). Also include :

  • nlambda: integer; the length of the lambdalist vector, by default 100

  • log.scale: boolean; should a logarithmic scale be used during the creation of lambdalist. By default, FALSE.

  • min.ratio : numeric parameter setting the smallest value of lambdalist in the log.scale case with the formula log10(min.ratio*lambdamax).

Value

An object of class "cv.fa" for which a plot method is available.

See Also

fusedanova, plot,cv.fa-method and cv.fa.

Examples

1
2
3
4
5
6
## Not run: 
data(aves)
cv.out <- cv.fa(aves$weight, aves$family)
V100.cv.out <- cv.fa(aves$weight, aves$family, V=50)

## End(Not run)