gpower_component_heatmap: Plots value of each column of the data for each component

Description Usage Arguments Examples

View source: R/plotting.R

Description

This plot shows the values of the components, connected to the columns of the original data. The heatmap is made using the pheatmap function from the pheatmap package.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
gpower_component_heatmap(
  data,
  k,
  rho,
  reg = "l1",
  center = TRUE,
  block = FALSE,
  mu = 1,
  variable_highlight = NA,
  cluster_variables = FALSE,
  show_variable_names = TRUE,
  ignore_full_zero = TRUE
)

Arguments

data

Input matrix of size (p x n) with p < n.

k

Number of components, 0 < k < p.

rho

Relative sparsity weight factor of the optimization. Either a vector of floats of size k or float which will be repeated k times. 0 < rho < 1.

reg

regularisation type to use in the optimization. Either 'l0' or 'l1'. The default is 'l1' since it performed best in experiments.

center

Centers the data. Either TRUE or FALSE. The default is TRUE.

block

Optimization method. If FALSE, the components are calculated individually. If TRUE, all components are calculated at the same time. The default is FALSE.

mu

Mean to be applied to each component in the block. Either a vector of float of size k or a float which will be repeated k times. Only used if block is TRUE. The default is 1.

variable_highlight

Add a color coding to the variables using a matrix with of size n x 1 where the row names are the same as the column names of the data matrix.

cluster_variables

Cluster the variables using hierarchical clustering.

show_variable_names

Show the names of the variables on the right side of the graph.

ignore_full_zero

Only show variables which have at least one non-zero weight.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
set.seed(360)
p <- 20
n <- 50
k <- 5
data <- scale(matrix(stats::rnorm(p * n), nrow = p, ncol = n), scale = FALSE)

gpower_component_heatmap(
  data = data,
  k = 5,
  rho = 0.1,
  reg = 'l1',
  center = TRUE,
  block = FALSE,
  mu = 1,
  variable_highlight = NA,
  cluster_variables = FALSE,
  show_variable_names = TRUE,
  ignore_full_zero = TRUE
)

plofknaapje/gpowerr documentation built on Dec. 22, 2021, 8:48 a.m.