fit: Fonction fit

Description Usage Arguments Value Examples

View source: R/fit.R

Description

Generate a plsda model according to formula and data provided. This model can be cross-validated.

Usage

1
2
fit(formula, data, ncomp = 2, cv = FALSE, nfold = 0, vs = FALSE,
  vs_crit = 1)

Arguments

formula

A valid statistical R formula.

data

The data to be used to rain the PLS-DA model. I must fit to the formula. The response must be a qualitative variable. The predictors must be a set of quantitative variables.

ncomp

The number of component to compute. If cross-validation is activated it will be used as the maximum number of component to return.

cv

If TRUE a cross-validation will be done. Default is FALSE.

nfold

If cv parameter is TRUE, nfold will specify the kind of cross-validation. Default is 0. A value of 0 will be equivalent to a "Leave One Out" cross-validation. If > 0 it will do a k-fold cross-validation with k = nfold.

vs

If TRUE an automatic variable selection will be done. Default is FALSE.

vs_crit

Treshold value for the variables selection (vs=TRUE). Default value : 1 (fit fonction)

Value

A plsda object that contains the component matrix, the trained model as coefficients, the explained variance on X and Y, VIP values, quality of the model and cross-validation results if asked

Examples

1
2
3
4
fit(Species ~ ., data = iris)
fit(Species ~ ., data = iris, 2)
fit(Species ~ ., data = iris, vs = TRUE)
fit(Species ~ ., data = iris, 4, cv = TRUE, nfold = 10)

Dampeel/plsda documentation built on May 23, 2019, 8:19 p.m.