public class PCAbySVD
extends java.lang.Object
prcomp.| Constructor and Description |
|---|
PCAbySVD(Matrix data)
Perform a principal component analysis, using the preferred SVD method, on a centered and scaled data matrix.
|
PCAbySVD(Matrix data,
boolean centered,
boolean scaled)
Perform a principal component analysis, using the preferred SVD method, on a given data matrix (possibly centered and/or scaled).
|
PCAbySVD(Matrix data,
boolean centered,
boolean scaled,
Vector mean,
Vector scale)
Perform a Principal Component Analysis, using the preferred SVD method,
on a given data matrix with (optional) mean vector and scaling vector provided.
|
| Modifier and Type | Method and Description |
|---|---|
Vector |
cumulativeProportionVar()
Get the cumulative proportion of overall variance explained by the principal components
|
ImmutableMatrix |
data()
Get the original data matrix.
|
Matrix |
loadings()
Get the matrix of variable loadings.
|
Vector |
loadings(int i)
Get the loading vector of the i-th principal component.
|
Vector |
mean()
Get the sample means that were subtracted.
|
int |
nFactors()
Get the number of variables in the original data.
|
int |
nObs()
Get the number of observations in the original data; sample size.
|
Vector |
proportionVar()
Get the proportion of overall variance explained by each of the principal components.
|
double |
proportionVar(int i)
Get the proportion of overall variance explained by the i-th principal component.
|
Vector |
scale()
Get the scalings applied to each variable,
the scaling vector to be divided.
|
Matrix |
scores()
Get the scores of supplied data on the principal components.
|
DenseVector |
sdPrincipalComponent()
Get the standard deviations of the principal components
(i.e., the square roots of the eigenvalues of the correlation (or covariance) matrix,
though the calculation is actually done with the singular values of the data matrix)
|
double |
sdPrincipalComponent(int i)
Get the standard deviation of the i-th principal component.
|
SVD |
svd()
Get the singular value decomposition (SVD) of matrix X.
|
Matrix |
X()
Get the (possibly centered and/or scaled) data matrix X used for the PCA.
|
public PCAbySVD(Matrix data, boolean centered, boolean scaled, Vector mean, Vector scale)
data - a matrix which provides the original data for the principal component analysiscentered - a logical value indicating whether the variables should be shifted to be zero centeredscaled - a logical value indicating whether the variables should be scaled to have unit variance before the analysis takes place
(N.B. in general scaling is advisable; however, it should only be used if there is no constant variable)mean - an optional mean vector (of length equal to nFactors) to be subtracted regardless of the flag 'centered'scale - an optional scaling vector (of length equal to nFactors) to be divided regardless of the flag 'scaled'public PCAbySVD(Matrix data, boolean centered, boolean scaled)
data - a matrix which provides the original data for the principal component analysiscentered - a logical value indicating whether the variables should be shifted to be zero centeredscaled - a logical value indicating whether the variables should be scaled to have unit variance before the analysis takes place
(N.B. in general scaling is advisable; however, it should only be used if there is no constant variable)public PCAbySVD(Matrix data)
data - a matrix which provides the original data for the principal component analysispublic Vector mean()
public Vector scale()
public SVD svd()
public DenseVector sdPrincipalComponent()
public Matrix loadings()
public ImmutableMatrix data()
public int nObs()
PCApublic int nFactors()
PCApublic Matrix X()
PCApublic double sdPrincipalComponent(int i)
PCAsdPrincipalComponent in interface PCAi - an index, counting from 1public Vector loadings(int i)
PCApublic Vector proportionVar()
PCAproportionVar in interface PCApublic double proportionVar(int i)
PCAproportionVar in interface PCAi - an index, counting from 1public Vector cumulativeProportionVar()
PCAcumulativeProportionVar in interface PCA