Class CovarianceMatrix.Population

java.lang.Object
org.bzdev.math.stats.CovarianceMatrix
org.bzdev.math.stats.CovarianceMatrix.Population
Enclosing class:
CovarianceMatrix

public static final class CovarianceMatrix.Population extends CovarianceMatrix
Class to compute the covariance matrix for a total set of values, as opposed to a sample of values.
  • Constructor Details

    • Population

      public Population(int n)
      Constructor. The method CovarianceMatrix.add(double[]) must be called repeatedly to provide the dataset used to compute the covariance matrix and mean array.
      Parameters:
      n - the number of variables
    • Population

      public Population(double[][] arrays, int n)
      Constructor given an array containing the initial dataset used to compute a covariance matrix. This dataset can be extended using the CovarianceMatrix.add(double[]) method.
      Parameters:
      arrays - an array, each component of which is an array containing the values for n variables
      n - the number of variables
  • Method Details

    • getCorrection

      protected double getCorrection()
      Description copied from class: CovarianceMatrix
      The elements of the variance array that is computed will be scaled by a correction factor. This factor should be 1.0 when the dataset represents a total population. For a sample of a population, the factor is m/(m-1) where m is the sample size.

      The subclasses CovarianceMatrix.Sample and CovarianceMatrix.Population provide suitable implementations of this method for those cases.

      Specified by:
      getCorrection in class CovarianceMatrix
      Returns:
      the correction factor; Double.NaN if the factor cannot be computed due to too few entries