R中的查找相关函数

findCorrelation function in R

我对 R 中 CARET 包中的 findCorrelation() 函数有一些疑问。

当我使用这段代码时:

  correlations <- cor(list)
  highCorr <- findCorrelation(correlations, cutoff = .6, names = FALSE)
  new_list <- list[, -highCorr]
  1. 是否删除了高于 0.6 和低于 -0.6 的所有特征?
  2. 假设我有两个相关的特征,男性和女性(由于缺少值,它们并不完全相同),如果它们相互关联,函数 select 如何删除哪一个?
  1. does it remove all features above 0.6 and underneath -0.6?

如果您要问的是两个变量之间大于 0.6 的成对相关与小于 -0.6 的成对相关是否被视为相同,那么答案是肯定的。来自文档:"The absolute values of pair-wise correlations are considered."

  1. how does the function select which one to remove if they are correlated with each other?

同样来自文档:"the function looks at the mean absolute correlation of each variable and removes the variable with the largest mean absolute correlation."换句话说,它根据它与所有其他变量的相关程度选择两个变量之一。

有关详细信息,请参阅 help(findCorrelation)