Class Cca

java.lang.Object
edu.cmu.tetrad.search.ntad_test.NtadTest
edu.cmu.tetrad.search.ntad_test.Cca

public class Cca extends NtadTest
The Cca class extends the NtadTest class and provides a mechanism to perform Canonical Correlation Analysis (CCA) as a rank-based way of getting a p-value for a tetrad.

Anderson, T. W., Anderson, T. W., Anderson, T. W., & Anderson, T. W. (1958). An introduction to multivariate statistical analysis (Vol. 2, pp. 3-5). New York: Wiley.

Huang, B., Low, C. J. H., Xie, F., Glymour, C., & Zhang, K. (2022). Latent hierarchical causal structure discovery with rank constraints. Advances in neural information processing systems, 35, 5549-5561.

Author:
bryanandrews
  • Constructor Summary

    Constructors
    Constructor
    Description
    Cca(org.ejml.simple.SimpleMatrix df, boolean correlations, int ess)
    Constructs a Cca object with the provided data matrix, covariance flag, and sample size.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    ntad(int[][] ntad)
    Computes the aggregate statistical measure based on a list of tetrad configurations.
    double
    ntad(int[][] ntad, boolean resample, double frac)
    Computes the aggregate statistical measure based on a list of tetrad configurations.
    double
    ntads(int[][]... ntads)
    Returns the p-value for the tetrad.
    double
    ntads(List<int[][]> ntads)
    Returns the p-value for the tetrad.
    int
    rank(int[][] ntad, double alpha)
    Determines the smallest rank value for which the hypothesis test returns a result below the specified alpha threshold using Wilks' lambda test.

    Methods inherited from class edu.cmu.tetrad.search.ntad_test.NtadTest

    allGreaterThanAlpha, variables

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Cca

      public Cca(org.ejml.simple.SimpleMatrix df, boolean correlations, int ess)
      Constructs a Cca object with the provided data matrix, covariance flag, and sample size.
      Parameters:
      df - the input data matrix as a SimpleMatrix object, where each row represents an observation and each column represents a variable
      correlations - a boolean flag indicating whether the provided matrix is a covariance matrix (true) or raw data requiring covariance computation (false)
      ess - the effective sample size (ess), which should be -1 or greater than 1. If -1, the sample size of the data matrix is used.
  • Method Details

    • ntad

      public double ntad(int[][] ntad, boolean resample, double frac)
      Computes the aggregate statistical measure based on a list of tetrad configurations. Each configuration specifies sets of indices representing structural relationships among variables. This method evaluates and combines results for all provided configurations, with optional resampling.
      Specified by:
      ntad in class NtadTest
      Parameters:
      ntad - a list of 2D integer arrays where each array contains multiple tetrad configurations. Each configuration defines sets of indices representing structural relationships among variables.
      resample - a boolean indicating whether resampling should be applied to the data matrix for the computation.
      frac - a double value representing the fraction of data to use during resampling, ignored if resample is false.
      Returns:
      a double value representing the sum of the statistical measures for all provided tetrad configurations.
    • rank

      public int rank(int[][] ntad, double alpha)
      Determines the smallest rank value for which the hypothesis test returns a result below the specified alpha threshold using Wilks' lambda test.
      Parameters:
      ntad - a 2D integer array where ntad[0] represents an array of indices for the x-block variables, and ntad[1] represents an array of indices for the y-block variables.
      alpha - a double value representing the significance level threshold to evaluate the hypothesis test.
      Returns:
      the smallest integer rank value for which the hypothesis test fails to reject the null hypothesis. If no such rank is found, returns the minimum of the lengths of the two index arrays.
    • ntad

      public double ntad(int[][] ntad)
      Computes the aggregate statistical measure based on a list of tetrad configurations. Each configuration specifies sets of indices representing structural relationships among variables. This method internally calls the overloaded version of `ntad` with optional resampling set to false and uses a default fraction of 1 for processing.
      Specified by:
      ntad in class NtadTest
      Parameters:
      ntad - a list of 2D integer arrays where each array contains multiple tetrad configurations. Each configuration defines sets of indices representing structural relationships among variables.
      Returns:
      a double value representing the sum of the statistical measures for all provided tetrad configurations.
    • ntads

      public double ntads(int[][]... ntads)
      Returns the p-value for the tetrad. This constructor is required by the interface, though in truth it will throw and exception if more than one tetrad is provided.
      Specified by:
      ntads in class NtadTest
      Parameters:
      ntads - A single tetrad.
      Returns:
      The p-value for the tetrad.
    • ntads

      public double ntads(List<int[][]> ntads)
      Returns the p-value for the tetrad. This constructor is required by the interface, though in truth it will throw and exception if more than one tetrad is provided.
      Specified by:
      ntads in class NtadTest
      Parameters:
      ntads - A single tetrad.
      Returns:
      The p-value for the tetrad.