rStats.js v1.3.0
    Preparing search index...

    Function factanal

    • Maximum-likelihood factor analysis of a data matrix (rows are observations) or, with options.covmat, of a covariance matrix. Equivalent to R's factanal(). With rotation "varimax", "promax" or "none".

      Parameters

      • x: readonly (readonly number[])[] | null

        The data matrix (array of rows), or null with options.covmat.

      • factors: number

        The number of factors.

      • options: FactanalOptions = {}

      Returns FactanalResult

      const R = [[1, 0.72, 0.63], [0.72, 1, 0.56], [0.63, 0.56, 1]];
      const fa = factanal(null, 1, { covmat: R });
      fa.uniquenesses; // [0.19, 0.36, 0.51]
      fa.loadings; // [[0.9], [0.8], [0.7]]
      // Factor scores need the data: factanal(x, 1, { scores: "regression" }).scores (one row per row of x)