Class FactorAnalysis
Rummel, R. J. (1988). Applied factor analysis. Northwestern University Press. This book is a good companion to the book listed above. While it doesn't specify any actual algorithm, it has a great introduction to the subject that gives the reader a good appreciation of the philosophy and the mathematics behind factor analysis.
This class is not configured to respect knowledge of forbidden and required edges.
- Version:
- $Id: $Id
- Author:
- Mike Freenor
-
Constructor Summary
ConstructorsConstructorDescriptionFactorAnalysis
(DataSet dataSet) Constructor.FactorAnalysis
(ICovarianceMatrix covarianceMatrix) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the matrix of residuals.void
setNumFactors
(int numFactors) Sets the number of factors to find.void
setThreshold
(double threshold) Sets the threshold.successiveFactorVarimax
(Matrix factorLoadingMatrix) Returns the matrix result for the varimax algorithm.Successive method with residual matrix.
-
Constructor Details
-
FactorAnalysis
Constructor.- Parameters:
covarianceMatrix
- The covariance matrix being analyzed.
-
FactorAnalysis
Constructor.- Parameters:
dataSet
- The continuous dataset being analyzed.
-
-
Method Details
-
successiveResidual
Successive method with residual matrix.This algorithm makes use of a helper algorithm. Together, they solve for an unrotated factor loading matrix.
This method calls upon its helper to find column vectors, with which it constructs its factor loading matrix. Upon receiving each successive column vector from its helper method, it makes sure that we want to keep this vector instead of discarding it. After keeping a vector, a residual matrix is calculated, upon which solving for the next column vector is directly dependent.
We stop looking for new vectors either when we've accounted for close to all the variance in the original correlation matrix, or when the "d scalar" for a new vector is less than 1 (the d-scalar is the corresponding diagonal for the factor loading matrix -- thus, when it's less than 1, the vector we've solved for barely accounts for any more variance). This means we've already "pulled out" all the variance we can from the residual matrix, and we should stop as further factors don't explain much more (and serve to complicate the model).
PSEUDO-CODE:
0th Residual Matrix = Original Correlation Matrix Ask helper for the 1st factor (first column vector in our factor loading vector) Add 1st factor's d-scalar (for i'th factor, call its d-scalar the i'th d-scalar) to a list of d-scalars.
While the ratio of the sum of d-scalars to the trace of the original correlation matrix is less than .99 (in other words, while we haven't accounted for practically all the variance):
i'th residual matrix = (i - 1)'th residual matrix SUBTRACT the major product moment of (i - 1)'th factor loading vector Ask helper for i'th factor If i'th factor's d-value is less than 1, throw it out and end loop. Otherwise, add it to the factor loading matrix and continue loop.
END PSEUDO-CODE
At the end of the method, the list of column vectors is actually assembled into a TetradMatrix.
- Returns:
- The matrix of residuals.
-
successiveFactorVarimax
-
setThreshold
public void setThreshold(double threshold) Sets the threshold.- Parameters:
threshold
- This threshold.
-
setNumFactors
public void setNumFactors(int numFactors) Sets the number of factors to find.- Parameters:
numFactors
- This number.
-
getResidual
-