mpmd: Multifactor Penalized Matrix Decomposition

Description Usage Arguments Value Examples

View source: R/mpmd.R

Description

Multifactor version of the rank-1 L1-penalized matrix decomposition in pmd. Components are found by applying pmd to the original matrix after deflation by deducting the components already found.

Usage

1
2
3
4
5
6
7
8
9
mpmd(
  Z,
  k = 2,
  c1 = 1,
  c2 = 1,
  maxit = 20,
  eps = sqrt(.Machine$double.eps),
  centre = FALSE
)

Arguments

Z

Matrix to be decomposed

k

Required rank of the result

c1

L1-norm bound for U (greater than or equal to 1), either length-1, or with k entries (one for each component).

c2

L1-norm bound for V (greater than or equal to 1), either length-1, or with k entries (one for each component)

maxit

Maximum number of iterations

eps

Stopping criterion, an absolute error tolerance on the mean squared reconstruction error

centre

Logical indicating whether to centre the matrix Z using the overall mean before analysis

Value

A list with the penalized singular value decomposition (d, U, V).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Simple random test matrix
set.seed(1)
Z <- matrix(rnorm(100), nrow = 20, ncol = 5)

## Ordinary SVD (equivalent up to changes in sign)
mpmd(Z, c1 = 5, c2 = 3, k = 5)
svd(Z)

## Test with constant c1 and c2
mpmd(Z, c1 = 2, c2 = 1.25, k = 5)

## Test with different c1 and c2 for different components
mpmd(Z, c1 = c(3, 1.25), c2 = c(2, 1.25), k = 2)

schoonees/spca documentation built on Jan. 31, 2021, 6:21 p.m.