public class PCAbySVD extends Object
prcomp
.Constructor and Description |
---|
PCAbySVD(Matrix data)
Performs Principal Component Analysis, using the preferred SVD method, on
a centered and scaled data matrix.
|
PCAbySVD(Matrix data,
boolean centered,
boolean scaled)
Performs Principal Component Analysis, using the preferred SVD method, on
a data matrix (possibly centered and/or scaled).
|
PCAbySVD(Matrix data,
Vector mean,
Vector scale)
Performs Principal Component Analysis, using the preferred SVD method, on
a data matrix with (optional) mean vector and scaling vector provided.
|
Modifier and Type | Method and Description |
---|---|
DenseVector |
cumulativeProportionVar()
Gets the cumulative proportion of overall variance explained by the
principal components
|
ImmutableMatrix |
data()
Gets the original data matrix.
|
Vector |
loading(int i)
Gets the loading vector of the i-th principal component.
|
Matrix |
loadings()
Gets the matrix of variable loadings.
|
Vector |
mean()
Gets the sample means that were subtracted.
|
int |
nFactors()
Gets the number of variables in the original data.
|
int |
nObs()
Gets the number of observations in the original data; sample size.
|
Vector |
proportionVar()
Gets the proportion of overall variance explained by each of the
principal components.
|
double |
proportionVar(int i)
Gets the proportion of overall variance explained by the i-th
principal component.
|
Vector |
scale()
Gets the scalings applied to each variable.
|
Matrix |
scores()
Gets the scores of supplied data on the principal components.
|
double |
sdPrincipalComponent(int i)
Gets the standard deviation of the i-th principal component.
|
DenseVector |
sdPrincipalComponents()
Gets 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)
|
SVD |
svd()
Gets the Singular Value Decomposition (SVD) of matrix X.
|
Matrix |
X()
Gets the (possibly centered and/or scaled) data matrix X used for
the PCA.
|
public PCAbySVD(Matrix data, Vector mean, Vector scale)
data
- a matrix that represents the original datamean
- 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 that represents the original datacentered
- 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 that represents the original datapublic Vector mean()
PCA
public Vector scale()
PCA
public SVD svd()
public DenseVector sdPrincipalComponents()
public Matrix loadings()
PCA
public ImmutableMatrix data()
public int nObs()
PCA
public int nFactors()
PCA
public Matrix X()
PCA
public double sdPrincipalComponent(int i)
PCA
sdPrincipalComponent
in interface PCA
i
- an index, counting from 1public Vector loading(int i)
PCA
public Vector proportionVar()
PCA
proportionVar
in interface PCA
public double proportionVar(int i)
PCA
proportionVar
in interface PCA
i
- an index, counting from 1public DenseVector cumulativeProportionVar()
PCA
cumulativeProportionVar
in interface PCA
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.