View source: R/feature.tree.independence.R
feature.tree.independence | R Documentation |
This function identifies independent features using Spearman's Rho, and a dendrogram tree cut step. The feature returned as 'independent' within is k-cluster is the feature with the least missingness or chosen at random in case of missingness ties.
feature.tree.independence(wdata)
wdata |
the metabolite data matrix. samples in row, metabolites in columns |
a data frame of 'k' cluster or group ids, and a 0/1 binary identifying if a feature was identified as and independent ('1') feature or not ('0').
cmat = matrix(1, 4, 4 ) cmat[1,] = c(1, 0.9, 0.9, 0.8) cmat[2,] = c(0.9, 1, 0.7, 0.6) cmat[3,] = c(0.9, 0.7, 1, 0.8) cmat[4,] = c(0.8, 0.6, 0.8,1) ## simulate some correlated data (multivariable random normal) set.seed(1110) ex_data = MASS::mvrnorm(n = 250, mu = c(5, 45, 25, 15), Sigma = cmat ) ## define the data set rownames(ex_data) = paste0("ind", 1:nrow(ex_data)) colnames(ex_data) = paste0("var", 1:ncol(ex_data)) ## run the function df = feature.tree.independence(ex_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.