Calculation of weights and the intermediate weight factors used in the calculation of biweight midcovariance and midcorrelation. The weights are designed such that outliers get smaller weights; the weights become zero for data points more than 9 median absolute deviations from the median.
bicovWeights(
x,
pearsonFallback = TRUE,
maxPOutliers = 1,
outlierReferenceWeight = 0.5625,
defaultWeight = 0)bicovWeightFactors(
x,
pearsonFallback = TRUE,
maxPOutliers = 1,
outlierReferenceWeight = 0.5625,
defaultFactor = NA)
bicovWeightsFromFactors(
u,
defaultWeight = 0)
A vector or a two-dimensional array (matrix or data frame). If two-dimensional, the weights will be calculated separately on each column.
A vector or matrix of weight factors, usually calculated by bicovWeightFactors
.
Logical: if the median absolute deviation is zero, should standard deviation be substituted?
Optional specification of the maximum proportion of outliers, i.e., data with weights equal to
outlierReferenceWeight
below.
A number between 0 and 1 specifying what is to be considered an outlier when calculating the proportion of outliers.
Value used for weights that correspond to a finite x
but the weights themselves
would not be finite, for example, when a column in x
is constant.
Value used for factors that correspond to a finite x
but the weights themselves
would not be finite, for example, when a column in x
is constant.
A vector or matrix of the same dimensions as the input x
giving the bisquare weights
(bicovWeights
and bicovWeightsFromFactors
) or the bisquare factors
(bicovWeightFactors
).
These functions are based on Equations (1) and (3) in Langfelder and Horvath (2012). The weight factor is denoted
u
in that article.
Langfelder and Horvath (2012) also describe the Pearson fallback and maximum proportion of outliers in detail. For a full discussion of the biweight midcovariance and midcorrelation, see Wilcox (2005).
Langfelder P, Horvath S (2012) Fast R Functions for Robust Correlations and Hierarchical Clustering Journal of Statistical Software 46(11) 1-17 PMID: 23050260 PMCID: PMC3465711 Wilcox RR (2005). Introduction to Robust Estimation and Hypothesis Testing. 2nd edition. Academic Press, Section 9.3.8, page 399 as well as Section 3.12.1, page 83.
# NOT RUN {
x = rnorm(100);
x[1] = 10;
plot(x, bicovWeights(x));
# }
Run the code above in your browser using DataLab