View source: R/empiricalBayesLM.R
bicovWeights | R Documentation |
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)
x |
A vector or a two-dimensional array (matrix or data frame). If two-dimensional, the weights will be calculated separately on each column. |
u |
A vector or matrix of weight factors, usually calculated by |
pearsonFallback |
Logical: if the median absolute deviation is zero, should standard deviation be substituted? |
maxPOutliers |
Optional specification of the maximum proportion of outliers, i.e., data with weights equal to
|
outlierReferenceWeight |
A number between 0 and 1 specifying what is to be considered an outlier when calculating the proportion of outliers. |
defaultWeight |
Value used for weights that correspond to a finite |
defaultFactor |
Value used for factors that correspond to a finite |
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).
A vector or matrix of the same dimensions as the input x
giving the bisquare weights
(bicovWeights
and bicovWeightsFromFactors
) or the bisquare factors
(bicovWeightFactors
).
Peter Langfelder
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.
bicor
x = rnorm(100);
x[1] = 10;
plot(x, bicovWeights(x));
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.