forked from emanuelealiverti/SOG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOG.Rd
44 lines (41 loc) · 1.38 KB
/
OG.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/OG.R
\name{OG}
\alias{OG}
\title{Orthogonal to Groups analysis}
\usage{
OG(X, z, K = max(2, round(NCOL(X)/10)), rescale = T)
}
\arguments{
\item{X}{n x p data matrix to preprocess.}
\item{z}{n x 1 vector with group information.}
\item{K}{approximation rank. The defaul is \code{max(2, round(NCOL(X)/100))}}
\item{rescaled}{Should the matrix \code{X} be rescaled? Default is \code{TRUE}.}
}
\value{
\itemize{
\item \verb{U} n x K matrix of scores.
\item \verb{S} K x p matrix of sparse loadings
}
}
\description{
Perform matrix decomposition under group constraints.
}
\details{
The function performs a matrix decomposition of the input matrix \code{X} with constraints on the left singular vectors and the group variable \code{z}.
The output is a matrix \code{U} of basis and a matrix \code{S} of scores such that \eqn{\tilde X = S * U^T}, where \eqn{\tilde X} is the rank-K approximation of \code{X}
}
\examples{
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)
}
\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).
}