# OG: Orthogonal to Groups analysis In emanuelealiverti/SOG:

## Description

Perform matrix decomposition under group constraints.

## Usage

 1 OG(X, z, K = max(2, round(NCOL(X)/10)), rescale = T) 

## Arguments

 X n x p data matrix to preprocess. z n x 1 vector with group information. K approximation rank. The defaul is max(2, round(NCOL(X)/100)) rescaled Should the matrix X be rescaled? Default is TRUE.

## Details

The function performs a matrix decomposition of the input matrix X with constraints on the left singular vectors and the group variable z. The output is a matrix U of basis and a matrix S of scores such that \tilde X = S * U^T, where \tilde X is the rank-K approximation of X

## Value

• U n x K matrix of scores.

• S K x p matrix of sparse loadings

## References

Aliverti, Lum, Johndrow and Dunson (2018). Removing the influence of a group variable in high-dimensional predictive modelling (https://arxiv.org/abs/1810.08255).

## Examples

 1 2 3 4 5 6 7 8 9 k.rid = 10 n = 5000 p = 200 W = matrix(rnorm(p*k.rid), k.rid) S = matrix(rnorm(n*k.rid), n) z = sample(rep(0:1, each=n/2)) lambda = rnorm( k.rid, mean = 0, sd = 1) A = jitter( (S - lambda * z ) %*% W) res = OG(X = A, z = z, K = 30) 

emanuelealiverti/SOG documentation built on Nov. 20, 2019, 12:45 a.m.