FindCorrelation Function in R
I Have a Few Q on findCorrelation() Function in Caret Package in R. When I Am Using This Code: Correlations
i have a few Q on findCorrelation() function in CARET package in R.
when i am using this code:
correlations <- cor(list)
highCorr <- findCorrelation(correlations, cutoff = .6, names = FALSE)
new_list <- list[, -highCorr]
- does it remove all features above 0.6 and underneath -0.6?
- lets say i have two correlated features, male and female (its not all the same because of missing values), how does the function select which one to remove if they are correlated with each other?
1 Answer
- does it remove all features above 0.6 and underneath -0.6?
If what you're asking is whether the pair-wise correlation between two variables being greater than 0.6 is treated the same as the pair-wise correlation being less than -0.6, then the answer is yes. From the documentation: "The absolute values of pair-wise correlations are considered."
- how does the function select which one to remove if they are correlated with each other?
Again from the documentation: "the function looks at the mean absolute correlation of each variable and removes the variable with the largest mean absolute correlation." So in other words, it chooses one of the two variables based on how correlated it is with all the other variables.
See help(findCorrelation) for more information.