September 2017
Beginner to intermediate
560 pages
25h 18m
English
Define helper functions to reorder the correlation matrix and identify hidden patterns in the matrix using hierarchical clustering:
> get_lower_triangle<-function(cormat){cormat[upper.tri(cormat)] <- NAreturn(cormat)}get_upper_triangle <- function(cormat){cormat[lower.tri(cormat)]<- NAreturn(cormat)}> reorder_cormat <- function(cormat){# Use correlation between variables as distancedd <- as.dist((1-cormat)/2)hc <- hclust(dd)cormat <-cormat[hc$order, hc$order]}
Read now
Unlock full access