gpower_comp_var_plot: Plots explained variance for each component as rho changes

Description Usage Arguments Examples

View source: R/plotting.R

Description

This plot shows what happens to the variance explained by each component if rho is increased. The individual explained variances are neither non-decreasing nor non-increasing. Their sum does trend downwards, but it is also not non-increasing just like the proportion of explained variance.

Usage

1
2
3
4
5
6
7
8
9
gpower_comp_var_plot(
  data,
  k,
  intervals,
  reg = "l1",
  center = TRUE,
  block = FALSE,
  mu = 1
)

Arguments

data

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

k

Number of components, 0 < k < p.

intervals

The amount of intervals in the range of values of rho for which gpower is run. For l1, the range of values is [0-1], for l0, the range is [0-0.33]. The block algorithms tend to stop at 0.4 and will only cover the range where gpower is able to run.

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.

Examples

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

gpower_comp_var_plot(
  data = data,
  k = k,
  intervals = 40,
  reg = 'l1',
  center = TRUE
)

plofknaapje/gpowerpca documentation built on July 27, 2021, 4:17 a.m.