find_repres: Find representative variables.

Description Usage Arguments Details Value Author(s) Examples

Description

Uses graph_vis community detection on the input graph and selects a number of variables from each community as representative.

Usage

1
find_repres(graph, ratio = 0.1, weighted = FALSE)

Arguments

graph

An arbitrary graph object of data in R.

ratio

A number between (0, 1) indicating the ratio of variables to be chosen as representative. Defaults to 0.1.

weighted

A logical indicating if the number of nodes selected from each community is weighted. Defaults to FALSE. See details for more information.

Details

The function uses graph_vis to detect communities of variables in the graph input. It sorts each community nodes based on their degree and selects an equal number of each based on ratio parameter. If weighted is TRUE it will select different number of nodes from each community based on their sizes.

Value

a vector containing names of representative variables.

Author(s)

Vahid Balazadeh, Elyas Heidari

Examples

1
2
3
4
5
6
7
8
data("NHANES")
## Using \code{\link[muvis]{min_forest}} graph
mf <- min_forest(data = NHANES[1:1000, ], levels = 10)
repres_vars <- find_repres(graph = mf$graph, ratio = .2)

## Using \code{\link[muvis]{ggm}} graph with \code{weighted = TRUE}
gm <- ggm(data = NHANES[1:1000, ], levels = 10)
repres_vars <- find_repres(graph = gm$graph, weighted = TRUE)

bAIo-lab/Questools documentation built on Nov. 9, 2019, 3:59 a.m.