get_corr_flags {COINr} | R Documentation |
Find highly-correlated indicators within groups
Description
This returns a data frame of any highly correlated indicators within the same aggregation group. The level of the aggregation
grouping can be controlled by the grouplev
argument.
Usage
get_corr_flags(
coin,
dset,
cor_thresh = 0.9,
thresh_type = "high",
cortype = "pearson",
grouplev = NULL,
roundto = 3,
use_directions = FALSE
)
Arguments
coin |
A coin class object |
dset |
The name of the data set to apply the function to, which should be accessible in |
cor_thresh |
A threshold to flag high correlation. Default 0.9. |
thresh_type |
Either |
cortype |
The type of correlation, either |
grouplev |
The level to group indicators in. E.g. if |
roundto |
Number of decimal places to round correlations to. Default 3. Set |
use_directions |
Logical: if |
Details
This function is motivated by the idea that having very highly-correlated indicators within the same group may amount to double counting, or possibly redundancy in the framework.
This function replaces the now-defunct hicorrSP()
from COINr < v1.0.
Value
A data frame with one entry for every indicator pair that is highly correlated within the same group, at the specified level. Pairs are only reported once, i.e. only uses the upper triangle of the correlation matrix.
Examples
# build example coin
coin <- build_example_coin(up_to = "Normalise", quietly = TRUE)
# get correlations between indicator over 0.75 within level 2 groups
get_corr_flags(coin, dset = "Normalised", cor_thresh = 0.75,
thresh_type = "high", grouplev = 2)