This function diagnoses predictors that have one unique value (i.e. are zero variance predictors) or predictors that are have both of the following characteristics: they have very few unique values relative to the number of samples and the ratio of the frequency of the most common value to the frequency of the second most common value is large.
nearZeroVar(x, freqCut = 95/5, uniqueCut = 10)
nearZeroVar
returns a list that contains the following components:freqRatio
, the ratio of frequencies
for the most common value over the second most common value and, percentUnique
,
the percentage of unique data points out of the total number of data points.To be flagged, first the frequency of the most prevalent value over the
second most frequent value (called the ``frequency ratio'') must be
above freqCut
. Secondly, the ``percent of unique values,'' the
number of unique values divided by the total number of samples (times
100), must also be below uniqueCut
.
In the above example, the frequency ratio is 999 and the unique value percentage is 0.0001.
pls
, spls
, plsda
, splsda