Description Usage Arguments Details Value Author(s) References Examples
Computes the rank K
sparse, sparse
non-negative, two-way sparse, and two-way sparse non-negative GPCA
solutions.
1 2 |
X |
The |
Q |
The row generalizing operator, an |
R |
The column generalizing operator, an |
K |
The number of GPCA components to compute. The default value is one. |
lamu |
The regularization parameter that determines the sparsity
level for the row factor, |
lamvs |
A scalar or vector of regularization parameters that
determine the sparsity level for the column factor, |
posu |
Flag indicating whether the row factor, |
posv |
Flag indicating whether the column factor, |
threshold |
Sets the threshold for convergence. The default value
is |
maxit |
Sets the maximum number of iterations. The default value
is |
full.path |
Flag indicating whether the entire solution path, or
the solution at each value of |
The sgpca
function has the flexibility to fit combinations of
sparsity and/or non-negativity for both the row and column generalized
PCs. Regularization is used to
encourage sparsity in the GPCA factors by placing an L1
penalty on the GPC loadings, V
, and or the sample GPCs,
U
. Non-negativity constraints on V
and/or U
yield sparse non-negative and two-way non-negative GPCA.
Generalizing operators as described for gpca
can be used
with this function and have the same properties.
When lamvs=0
, lamu=0
, posu=0
, and posv=0
,
the GPCA solution also given by gpca
is returned. The
magnitude of the regularization parameters, lamvs
and
lamu
, determine the level of sparsity of the factors
U
and V
, with higher regularization parameter values
yielding sparser factors.
If more than one regularization value lamvs
is given, then
sgpca
finds the optimal regularization parameter
lamvs
by minimizing the BIC derived from the generalized
least squares update for each factor.
If full.path = TRUE
, then the full path of solutions (U
,
D
, and V
) is returned for each value of lamvs
given. This option is best used with 50 or 100 values of
lamvs
to well approximate the regularization paths.
Numerically, the path begins with the GPCA solution, lamvs=0
,
and uses warm starts at each step as lamvs
increases.
Proximal gradient descent is used to compute each rank-one solution. Multiple components are calculated in a greedy manner via deflation. Each rank-one solution is solved by iteratively fitting generalized least squares problems with penalties or non-negativity constraints. These regression problems are solved by the Iterative Soft-Thresholding Algorithm (ISTA) or projected gradient descent.
U |
The left sparse GPCA factors, an |
V |
The right sparse GPCA factors, a |
D |
A vector of the K sparse GPCA values. If
|
cumulative.prop.var |
The cumulative proportion of variance explained by the components |
bics |
The BIC values computed for each value of |
optlams |
Optimal regularization parameter as chosen by the BIC
method for each of the |
Frederick Campbell
Genevera I. Allen, Logan Grosenick, and Jonathan Taylor, "A generalized least squares matrix decomposition", arXiv:1102.3074, 2011.
Genevera I. Allen and Mirjana Maletic-Savatic, "Sparse Non-negative Generalized PCA with Applications to Metabolomics", Bioinformatics, 27:21, 3029-3035, 2011.
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 | data(ozone2)
ind = which(apply(is.na(ozone2$y),2,sum)==0)
X = ozone2$y[,ind]
n = nrow(X)
p = ncol(X)
#Generalizing Operators - Spatio-Temporal Smoothers
R = Exp.cov(ozone2$lon.lat[ind,],theta=5)
er = eigen(R,only.values=TRUE);
R = R/max(er$values)
Q = Exp.cov(c(1:n),c(1:n),theta=3)
eq = eigen(Q,only.values=TRUE)
Q = Q/max(eq$values)
#Sparse GPCA
fit = sgpca(X,Q,R,K=1,lamu=0,lamvs=c(.5,1))
fit$prop.var #proportion of variance explained
fit$optlams #optimal regularization param chosen by BIC
fit$bics #BIC values for each lambda
#Sparse Non-negative GPCA
fit = sgpca(X,Q,R,K=1,lamu=0,lamvs=1,posv=TRUE)
#Two-way Sparse GPCA
fit = sgpca(X,Q,R,K=1,lamu=1,lamvs=1)
#Two-way Sparse Non-negative GPCA
fit = sgpca(X,Q,R,K=1,lamu=1,lamvs=1,posu=TRUE,posv=TRUE)
#Return full regularization paths for inputted lambda values
fit = sgpca(X,Q,R,K=1,lamu=0,lamvs=c(.1,.5,1),full.path=TRUE)
|
Loading required package: Matrix
Loading required package: fields
Loading required package: spam
Loading required package: dotCall64
Loading required package: grid
Spam version 2.1-1 (2017-07-02) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.
Attaching package: 'spam'
The following objects are masked from 'package:base':
backsolve, forwardsolve
Loading required package: maps
NULL
[1] 0.5
[1] 1.727363
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.