Class FactorAnalysis


  • public class FactorAnalysis
    extends Object
    Factor analysis is a statistical method used to describe variability among observed variables in terms of a potentially lower number of unobserved variables called factors. Factor analysis searches for joint variations in response to unobserved latent variables. The observed variables are modeled as linear combinations of the potential factors, plus "error" terms. The information gained about the interdependencies between observed variables can be used later to reduce the set of variables in a dataset. Although factor analysis and principal component analysis (PCA) are both dimension reduction techniques, those two are not identical. Because PCA performs a variance-maximizing rotation of the variable space, it takes into account all variability in the variables. In contrast, factor analysis estimates how much of the variability is due to common factors. The two methods become essentially equivalent if the error terms in the factor analysis model can be assumed to all have the same variance.

    The R equivalent function is factanal.

    See Also:
    • M. S. Bartlett, "The Statistical Conception of Mental Factors," The British Journal of Psychology, vol. 28, 97-104, 1937.
    • M. S. Bartlett, "A Note on Multiplying Factors for Various Chi-Squared Approximations," Journal of the Royal Statistical Society, Series B, vol. 16, 296-298, 1954.
    • K. G. Jöreskog, "Statistical Estimation in Factor Analysis: A New Technique and Its Foundation," Almqvist and Wicksell, 1963.
    • D. N. Lawley and A. E. Maxwell, "Factor Analysis as a Statistical Method," Second Edition, Butterworths, 1971.
    • G. H. Thomson, "The Factorial Analysis of Human Ability," London University Press, 1951.
    • Wikipedia: Factor analysis
    • Constructor Detail

      • FactorAnalysis

        public FactorAnalysis​(Matrix data,
                              int nFactors,
                              FactorAnalysis.ScoringRule rule,
                              Matrix S)
        Performs factor analysis on the data set with a user defined scoring rule and a user defined covariance (or correlation) matrix.

        Parameters:
        data - the data set
        nFactors - the number of factors
        rule - the scoring rule
        S - a covariance (or correlation) matrix, usually taken to be the covariance (or correlation) matrix of the data set. Using a correlation matrix amounts to scaling the original data set
      • FactorAnalysis

        public FactorAnalysis​(Matrix data,
                              int nFactors,
                              FactorAnalysis.ScoringRule rule)
        Performs factor analysis on the data set with a user defined scoring rule.
        Parameters:
        data - the data set
        nFactors - the number of factors
        rule - the scoring rule
      • FactorAnalysis

        public FactorAnalysis​(Matrix data,
                              int nFactors)
        Performs factor analysis on the data set, using Bartlett's weighted least-squares scores, and sample correlation matrix.
        Parameters:
        data - the data set
        nFactors - the number of factors
    • Method Detail

      • S

        public ImmutableMatrix S()
        Gets the covariance (or correlation) matrix.
        Returns:
        the covariance (or correlation) matrix
      • nObs

        public int nObs()
        Gets the number of observations.
        Returns:
        the number of observations
      • nVariables

        public int nVariables()
        Gets the number of variables in the original data set.
        Returns:
        the number of variables in the original data set
      • nFactors

        public int nFactors()
        Gets the number of factors.
        Returns:
        the number of factors
      • getEstimators

        public FAEstimator getEstimators​(int maxIterations)
        Gets the estimators (estimated psi, loading matrix, degree of freedom, test statistics, p-value, etc) obtained from the factor analysis, given the maximum number of iterations.
        Parameters:
        maxIterations - the maximum number of iterations
        Returns:
        the estimators from the factor analysis
      • getEstimators

        public FAEstimator getEstimators​(Vector initial,
                                         int maxIterations)
        Gets the estimators (estimated psi, loading matrix, degree of freedom, test statistics, p-value, etc) obtained from the factor analysis, given the initial psi and the maximum number of iterations.
        Parameters:
        initial - the initial values of psi
        maxIterations - the maximum number of iterations
        Returns:
        the estimators from the factor analysis