blob: 65a6c1ef27b4b47d0cced2c7576d584636fbb41a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>PearsonsCorrelation (Apache Commons Math 3.3 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="PearsonsCorrelation (Apache Commons Math 3.3 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/PearsonsCorrelation.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/commons/math3/stat/correlation/KendallsCorrelation.html" title="class in org.apache.commons.math3.stat.correlation"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../org/apache/commons/math3/stat/correlation/SpearmansCorrelation.html" title="class in org.apache.commons.math3.stat.correlation"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html" target="_top">Frames</a></li>
<li><a href="PearsonsCorrelation.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.math3.stat.correlation</div>
<h2 title="Class PearsonsCorrelation" class="title">Class PearsonsCorrelation</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.commons.math3.stat.correlation.PearsonsCorrelation</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">PearsonsCorrelation</span>
extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">Computes Pearson's product-moment correlation coefficients for pairs of arrays
or columns of a matrix.
<p>The constructors that take <code>RealMatrix</code> or
<code>double[][]</code> arguments generate correlation matrices. The
columns of the input matrices are assumed to represent variable values.
Correlations are given by the formula</p>
<p><code>cor(X, Y) = &Sigma;[(x<sub>i</sub> - E(X))(y<sub>i</sub> - E(Y))] / [(n - 1)s(X)s(Y)]</code>
where <code>E(X)</code> is the mean of <code>X</code>, <code>E(Y)</code>
is the mean of the <code>Y</code> values and s(X), s(Y) are standard deviations.</p>
<p>To compute the correlation coefficient for a single pair of arrays, use <a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#PearsonsCorrelation()"><code>PearsonsCorrelation()</code></a>
to construct an instance with no data and then <a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#correlation(double[], double[])"><code>correlation(double[], double[])</code></a>.
Correlation matrices can also be computed directly from an instance with no data using
<a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#computeCorrelationMatrix(double[][])"><code>computeCorrelationMatrix(double[][])</code></a>. In order to use <a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#getCorrelationMatrix()"><code>getCorrelationMatrix()</code></a>,
<a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#getCorrelationPValues()"><code>getCorrelationPValues()</code></a>, or <a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#getCorrelationStandardErrors()"><code>getCorrelationStandardErrors()</code></a>; however, one of the
constructors supplying data or a covariance matrix must be used to create the instance.</p></div>
<dl><dt><span class="strong">Since:</span></dt>
<dd>2.0</dd>
<dt><span class="strong">Version:</span></dt>
<dd>$Id: PearsonsCorrelation.java 1540395 2013-11-09 21:32:06Z psteitz $</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#PearsonsCorrelation()">PearsonsCorrelation</a></strong>()</code>
<div class="block">Create a PearsonsCorrelation instance without data.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#PearsonsCorrelation(org.apache.commons.math3.stat.correlation.Covariance)">PearsonsCorrelation</a></strong>(<a href="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html" title="class in org.apache.commons.math3.stat.correlation">Covariance</a>&nbsp;covariance)</code>
<div class="block">Create a PearsonsCorrelation from a <a href="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html" title="class in org.apache.commons.math3.stat.correlation"><code>Covariance</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#PearsonsCorrelation(double[][])">PearsonsCorrelation</a></strong>(double[][]&nbsp;data)</code>
<div class="block">Create a PearsonsCorrelation from a rectangular array
whose columns represent values of variables to be correlated.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#PearsonsCorrelation(org.apache.commons.math3.linear.RealMatrix)">PearsonsCorrelation</a></strong>(<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;matrix)</code>
<div class="block">Create a PearsonsCorrelation from a RealMatrix whose columns
represent variables to be correlated.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#PearsonsCorrelation(org.apache.commons.math3.linear.RealMatrix, int)">PearsonsCorrelation</a></strong>(<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;covarianceMatrix,
int&nbsp;numberOfObservations)</code>
<div class="block">Create a PearsonsCorrelation from a covariance matrix.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#computeCorrelationMatrix(double[][])">computeCorrelationMatrix</a></strong>(double[][]&nbsp;data)</code>
<div class="block">Computes the correlation matrix for the columns of the
input rectangular array.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#computeCorrelationMatrix(org.apache.commons.math3.linear.RealMatrix)">computeCorrelationMatrix</a></strong>(<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;matrix)</code>
<div class="block">Computes the correlation matrix for the columns of the
input matrix, using <a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#correlation(double[], double[])"><code>correlation(double[], double[])</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#correlation(double[], double[])">correlation</a></strong>(double[]&nbsp;xArray,
double[]&nbsp;yArray)</code>
<div class="block">Computes the Pearson's product-moment correlation coefficient between two arrays.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#covarianceToCorrelation(org.apache.commons.math3.linear.RealMatrix)">covarianceToCorrelation</a></strong>(<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;covarianceMatrix)</code>
<div class="block">Derives a correlation matrix from a covariance matrix.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#getCorrelationMatrix()">getCorrelationMatrix</a></strong>()</code>
<div class="block">Returns the correlation matrix.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#getCorrelationPValues()">getCorrelationPValues</a></strong>()</code>
<div class="block">Returns a matrix of p-values associated with the (two-sided) null
hypothesis that the corresponding correlation coefficient is zero.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#getCorrelationStandardErrors()">getCorrelationStandardErrors</a></strong>()</code>
<div class="block">Returns a matrix of standard errors associated with the estimates
in the correlation matrix.<br/>
<code>getCorrelationStandardErrors().getEntry(i,j)</code> is the standard
error associated with <code>getCorrelationMatrix.getEntry(i,j)</code></div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="PearsonsCorrelation()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PearsonsCorrelation</h4>
<pre>public&nbsp;PearsonsCorrelation()</pre>
<div class="block">Create a PearsonsCorrelation instance without data.</div>
</li>
</ul>
<a name="PearsonsCorrelation(double[][])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PearsonsCorrelation</h4>
<pre>public&nbsp;PearsonsCorrelation(double[][]&nbsp;data)</pre>
<div class="block">Create a PearsonsCorrelation from a rectangular array
whose columns represent values of variables to be correlated.
Throws MathIllegalArgumentException if the input array does not have at least
two columns and two rows. Pairwise correlations are set to NaN if one
of the correlates has zero variance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - rectangular array with columns representing variables</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></code> - if the input data array is not
rectangular with at least two rows and two columns.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#correlation(double[], double[])"><code>correlation(double[], double[])</code></a></dd></dl>
</li>
</ul>
<a name="PearsonsCorrelation(org.apache.commons.math3.linear.RealMatrix)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PearsonsCorrelation</h4>
<pre>public&nbsp;PearsonsCorrelation(<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;matrix)</pre>
<div class="block">Create a PearsonsCorrelation from a RealMatrix whose columns
represent variables to be correlated.
Throws MathIllegalArgumentException if the matrix does not have at least
two columns and two rows. Pairwise correlations are set to NaN if one
of the correlates has zero variance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>matrix</code> - matrix with columns representing variables to correlate</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></code> - if the matrix does not contain sufficient data</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#correlation(double[], double[])"><code>correlation(double[], double[])</code></a></dd></dl>
</li>
</ul>
<a name="PearsonsCorrelation(org.apache.commons.math3.stat.correlation.Covariance)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PearsonsCorrelation</h4>
<pre>public&nbsp;PearsonsCorrelation(<a href="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html" title="class in org.apache.commons.math3.stat.correlation">Covariance</a>&nbsp;covariance)</pre>
<div class="block">Create a PearsonsCorrelation from a <a href="../../../../../../org/apache/commons/math3/stat/correlation/Covariance.html" title="class in org.apache.commons.math3.stat.correlation"><code>Covariance</code></a>. The correlation
matrix is computed by scaling the Covariance's covariance matrix.
The Covariance instance must have been created from a data matrix with
columns representing variable values.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>covariance</code> - Covariance instance</dd></dl>
</li>
</ul>
<a name="PearsonsCorrelation(org.apache.commons.math3.linear.RealMatrix, int)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>PearsonsCorrelation</h4>
<pre>public&nbsp;PearsonsCorrelation(<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;covarianceMatrix,
int&nbsp;numberOfObservations)</pre>
<div class="block">Create a PearsonsCorrelation from a covariance matrix. The correlation
matrix is computed by scaling the covariance matrix.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>covarianceMatrix</code> - covariance matrix</dd><dd><code>numberOfObservations</code> - the number of observations in the dataset used to compute
the covariance matrix</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getCorrelationMatrix()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCorrelationMatrix</h4>
<pre>public&nbsp;<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;getCorrelationMatrix()</pre>
<div class="block">Returns the correlation matrix.
<p>This method will return null if the argumentless constructor was used
to create this instance, even if <a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#computeCorrelationMatrix(double[][])"><code>computeCorrelationMatrix(double[][])</code></a>
has been called before it is activated.</p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>correlation matrix</dd></dl>
</li>
</ul>
<a name="getCorrelationStandardErrors()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCorrelationStandardErrors</h4>
<pre>public&nbsp;<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;getCorrelationStandardErrors()</pre>
<div class="block">Returns a matrix of standard errors associated with the estimates
in the correlation matrix.<br/>
<code>getCorrelationStandardErrors().getEntry(i,j)</code> is the standard
error associated with <code>getCorrelationMatrix.getEntry(i,j)</code>
<p>The formula used to compute the standard error is <br/>
<code>SE<sub>r</sub> = ((1 - r<sup>2</sup>) / (n - 2))<sup>1/2</sup></code>
where <code>r</code> is the estimated correlation coefficient and
<code>n</code> is the number of observations in the source dataset.</p>
<p>To use this method, one of the constructors that supply an input
matrix must have been used to create this instance.</p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>matrix of correlation standard errors</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if this instance was created with no data</dd></dl>
</li>
</ul>
<a name="getCorrelationPValues()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCorrelationPValues</h4>
<pre>public&nbsp;<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;getCorrelationPValues()</pre>
<div class="block">Returns a matrix of p-values associated with the (two-sided) null
hypothesis that the corresponding correlation coefficient is zero.
<p><code>getCorrelationPValues().getEntry(i,j)</code> is the probability
that a random variable distributed as <code>t<sub>n-2</sub></code> takes
a value with absolute value greater than or equal to <br>
<code>|r|((n - 2) / (1 - r<sup>2</sup>))<sup>1/2</sup></code></p>
<p>The values in the matrix are sometimes referred to as the
<i>significance</i> of the corresponding correlation coefficients.</p>
<p>To use this method, one of the constructors that supply an input
matrix must have been used to create this instance.</p></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>matrix of p-values</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MaxCountExceededException.html" title="class in org.apache.commons.math3.exception">MaxCountExceededException</a></code> - if an error occurs estimating probabilities</dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if this instance was created with no data</dd></dl>
</li>
</ul>
<a name="computeCorrelationMatrix(org.apache.commons.math3.linear.RealMatrix)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>computeCorrelationMatrix</h4>
<pre>public&nbsp;<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;computeCorrelationMatrix(<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;matrix)</pre>
<div class="block">Computes the correlation matrix for the columns of the
input matrix, using <a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#correlation(double[], double[])"><code>correlation(double[], double[])</code></a>.
Throws MathIllegalArgumentException if the matrix does not have at least
two columns and two rows. Pairwise correlations are set to NaN if one
of the correlates has zero variance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>matrix</code> - matrix with columns representing variables to correlate</dd>
<dt><span class="strong">Returns:</span></dt><dd>correlation matrix</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></code> - if the matrix does not contain sufficient data</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#correlation(double[], double[])"><code>correlation(double[], double[])</code></a></dd></dl>
</li>
</ul>
<a name="computeCorrelationMatrix(double[][])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>computeCorrelationMatrix</h4>
<pre>public&nbsp;<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;computeCorrelationMatrix(double[][]&nbsp;data)</pre>
<div class="block">Computes the correlation matrix for the columns of the
input rectangular array. The columns of the array represent values
of variables to be correlated.
Throws MathIllegalArgumentException if the matrix does not have at least
two columns and two rows or if the array is not rectangular. Pairwise
correlations are set to NaN if one of the correlates has zero variance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - matrix with columns representing variables to correlate</dd>
<dt><span class="strong">Returns:</span></dt><dd>correlation matrix</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></code> - if the array does not contain sufficient data</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#correlation(double[], double[])"><code>correlation(double[], double[])</code></a></dd></dl>
</li>
</ul>
<a name="correlation(double[], double[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>correlation</h4>
<pre>public&nbsp;double&nbsp;correlation(double[]&nbsp;xArray,
double[]&nbsp;yArray)</pre>
<div class="block">Computes the Pearson's product-moment correlation coefficient between two arrays.
<p>Throws MathIllegalArgumentException if the arrays do not have the same length
or their common length is less than 2. Returns <code>NaN</code> if either of the arrays
has zero variance (i.e., if one of the arrays does not contain at least two distinct
values).</p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>xArray</code> - first data array</dd><dd><code>yArray</code> - second data array</dd>
<dt><span class="strong">Returns:</span></dt><dd>Returns Pearson's correlation coefficient for the two arrays</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/DimensionMismatchException.html" title="class in org.apache.commons.math3.exception">DimensionMismatchException</a></code> - if the arrays lengths do not match</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></code> - if there is insufficient data</dd></dl>
</li>
</ul>
<a name="covarianceToCorrelation(org.apache.commons.math3.linear.RealMatrix)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>covarianceToCorrelation</h4>
<pre>public&nbsp;<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;covarianceToCorrelation(<a href="../../../../../../org/apache/commons/math3/linear/RealMatrix.html" title="interface in org.apache.commons.math3.linear">RealMatrix</a>&nbsp;covarianceMatrix)</pre>
<div class="block">Derives a correlation matrix from a covariance matrix.
<p>Uses the formula <br/>
<code>r(X,Y) = cov(X,Y)/s(X)s(Y)</code> where
<code>r(&middot,&middot;)</code> is the correlation coefficient and
<code>s(&middot;)</code> means standard deviation.</p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>covarianceMatrix</code> - the covariance matrix</dd>
<dt><span class="strong">Returns:</span></dt><dd>correlation matrix</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/PearsonsCorrelation.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/commons/math3/stat/correlation/KendallsCorrelation.html" title="class in org.apache.commons.math3.stat.correlation"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../org/apache/commons/math3/stat/correlation/SpearmansCorrelation.html" title="class in org.apache.commons.math3.stat.correlation"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html" target="_top">Frames</a></li>
<li><a href="PearsonsCorrelation.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2003&#x2013;2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>