org.apache.commons.math.stat.correlation
Class PearsonsCorrelationTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.math.stat.correlation.PearsonsCorrelationTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
SpearmansRankCorrelationTest

public class PearsonsCorrelationTest
extends junit.framework.TestCase


Field Summary
protected  double[] longleyData
           
protected  double[] swissData
           
 
Constructor Summary
PearsonsCorrelationTest()
           
 
Method Summary
protected  org.apache.commons.math.linear.RealMatrix createLowerTriangularRealMatrix(double[] data, int dimension)
           
protected  org.apache.commons.math.linear.RealMatrix createRealMatrix(double[] data, int nRows, int nCols)
           
protected  void fillUpper(org.apache.commons.math.linear.RealMatrix matrix, double diagonalValue)
           
 void testConsistency()
           
 void testConstant()
          Constant column
 void testCovarianceConsistency()
          Verify that creating correlation from covariance gives same results as direct computation from the original matrix
 void testInsufficientData()
          Insufficient data
 void testLongly()
          Test Longley dataset against R.
 void testStdErrorConsistency()
          Verify that direct t-tests using standard error estimates are consistent with reported p-values
 void testSwissFertility()
          Test R Swiss fertility dataset against R.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

longleyData

protected final double[] longleyData

swissData

protected final double[] swissData
Constructor Detail

PearsonsCorrelationTest

public PearsonsCorrelationTest()
Method Detail

testLongly

public void testLongly()
                throws Exception
Test Longley dataset against R.

Throws:
Exception

testSwissFertility

public void testSwissFertility()
                        throws Exception
Test R Swiss fertility dataset against R.

Throws:
Exception

testConstant

public void testConstant()
Constant column


testInsufficientData

public void testInsufficientData()
Insufficient data


testStdErrorConsistency

public void testStdErrorConsistency()
                             throws Exception
Verify that direct t-tests using standard error estimates are consistent with reported p-values

Throws:
Exception

testCovarianceConsistency

public void testCovarianceConsistency()
                               throws Exception
Verify that creating correlation from covariance gives same results as direct computation from the original matrix

Throws:
Exception

testConsistency

public void testConsistency()

createRealMatrix

protected org.apache.commons.math.linear.RealMatrix createRealMatrix(double[] data,
                                                                     int nRows,
                                                                     int nCols)

createLowerTriangularRealMatrix

protected org.apache.commons.math.linear.RealMatrix createLowerTriangularRealMatrix(double[] data,
                                                                                    int dimension)

fillUpper

protected void fillUpper(org.apache.commons.math.linear.RealMatrix matrix,
                         double diagonalValue)


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.