public class PCAbyEigen extends Object
princomp
. The main difference is that we
use divisor (nObs - 1) instead of nObs for the sample
covariance matrix.Constructor and Description |
---|
PCAbyEigen(Matrix data)
Performs Principal Component Analysis, using the eigen method and using
correlation matrix, on a data matrix.
|
PCAbyEigen(Matrix data,
boolean correlation)
Performs Principal Component Analysis, using the eigen method, on a data
matrix.
|
PCAbyEigen(Matrix data,
boolean correlation,
Matrix V)
Performs Principal Component Analysis, using the eigen method,
on a data matrix with an optional correlation (or covariance) matrix
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.
|
Eigen |
eigen()
Gets the eigenvalue decomposition of the correlation (or covariance)
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.
|
Vector |
sdPrincipalComponents()
Gets the standard deviations of the principal components (i.e., the
square roots of the eigenvalues of the correlation (or covariance)
matrix).
|
Matrix |
V()
Gets the correlation (or covariance) matrix used by the PCA.
|
Matrix |
X()
Gets the (possibly centered and/or scaled) data matrix X used for
the PCA.
|
public PCAbyEigen(Matrix data, boolean correlation, Matrix V)
data
- an (nObs * nFactors) numeric matrix that
represents the original datacorrelation
- a logical value indicating whether the correlation
matrix (preferred) or the covariance matrix should be
used (N.B. the correlation matrix can only be used if there is no
constant variable)V
- an optional correlation (or covariance) matrix; if
supplied, this is used rather than the correlation (or
covariance) matrix of the centered (and possibly scaled) datapublic PCAbyEigen(Matrix data, boolean correlation)
data
- a matrix that represents the original datacorrelation
- a logical value indicating whether the correlation
matrix (preferred) or the covariance matrix should be
used (N.B. the correlation matrix can only be used if there is no
constant variable)public PCAbyEigen(Matrix data)
data
- matrix that represents the original datapublic Vector scale()
public Matrix V()
public Eigen eigen()
public Vector sdPrincipalComponents()
public Matrix loadings()
PCA
public Vector loading(int i)
PCA
public Vector proportionVar()
PCA
proportionVar
in interface PCA
public ImmutableMatrix data()
public int nObs()
PCA
public int nFactors()
PCA
public Vector mean()
PCA
public Matrix X()
PCA
public double sdPrincipalComponent(int i)
PCA
sdPrincipalComponent
in interface PCA
i
- an index, counting from 1public 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.