<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="m10673">

  <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Correlation and Covariance of a Random Signal</name>

  <metadata xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
  <md:version xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2.2</md:version>
  <md:created xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2002/06/19</md:created>
  <md:revised xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2004/11/30 10:44:07 US/Central</md:revised>
  <md:authorlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
      <md:author xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="mjhaag">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Michael</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Haag</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">mjhaag@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="mjhaag">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Michael</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Haag</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">mjhaag@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  

  <md:abstract xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">(Blank Abstract)</md:abstract>
</metadata>

  <content xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="delete_me">
      When we take the <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" document="m10656" strength="8">expected
      value</cnxn>, or average, of a <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" document="m10649" target="rp" strength="8">random process</cnxn>, we measure
      several important characteristics about how the process behaves
      in general.  This proves to be a very important observation.
      However, suppose we have several random processes measuring
      different aspects of a system.  The relationship between these
      different processes will also be an important observation.  The
      covariance and correlation are two important tools in finding
      these relationships.  Below we will go into more details as to
      what these words mean and how these tools are helpful.  Note
      that much of the following discussions refer to just random
      variables, but keep in mind that these variables can represent
      random signals or random processes.
    </para>

    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="cov">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Covariance</name>
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="p1_cov">
	To begin with, when dealing with more than one random process,
	it should be obvious that it would be nice to be able to have
	a number that could quickly give us an idea of how similar
	the processes are.  To do this, we use the
	<term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">covariance</term>, which is analogous to the variance of
	a single variable.  

	<definition xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="def_cov">
	  <term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Covariance</term>
	  <meaning xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    A measure of how much the deviations of two or more
	    variables or processes match.
	  </meaning>
	</definition>

	For two processes, <m:math><m:ci>X</m:ci></m:math> and
	<m:math><m:ci>Y</m:ci> </m:math>, if they are
	<emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">not</emphasis> closely related then the covariance
	will be small, and if they are similar then the covariance
	will be large.  Let us clarify this statement by describing
	what we mean by "related" and "similar."  Two processes are
	"closely related" if their distribution spreads are almost
	equal and they are around the same, or a very slightly
	different, mean.
      </para>
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="p2_cov">
	Mathematically, covariance is often written as
	<m:math display="inline">
	  <m:apply>
	    <m:ci>
	      <m:msub>
		<m:mi>σ</m:mi>
		<m:mrow>
		  <m:mi>x</m:mi>
		  <m:mi>y</m:mi>
		</m:mrow>
	      </m:msub>
	    </m:ci>
	  </m:apply>
	</m:math>

	and is defined as

	<equation xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="eq_cov">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="fn">cov</m:ci>
		<m:ci>X</m:ci>
		<m:ci>Y</m:ci>
	      </m:apply>
	      <m:apply>
		<m:ci>
		  <m:msub>
		    <m:mi>σ</m:mi>
		    <m:mrow>
		      <m:mi>x</m:mi>
		      <m:mi>y</m:mi>
		    </m:mrow>
		  </m:msub>
		</m:ci>
	      </m:apply>
	      <m:apply>
		<m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#expectedvalue"/>	
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:minus/>
		    <m:ci>X</m:ci>
		    <m:apply>
		      <m:mean/>
		      <m:ci>X</m:ci>
		    </m:apply>
		  </m:apply>
		  <m:apply>
		    <m:minus/>
		    <m:ci>Y</m:ci>
		    <m:apply>
		      <m:mean/>
		      <m:ci>Y</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>
      
	This can also be reduced and rewritten in the following two
	forms:

	<equation xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="eqa_cov">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci>
		  <m:msub>
		    <m:mi>σ</m:mi>
		    <m:mrow>
		      <m:mi>x</m:mi>
		      <m:mi>y</m:mi>
		    </m:mrow>
		  </m:msub>
		</m:ci>
	      </m:apply>
	      <m:apply>
		<m:minus/>
		<m:apply>
		  <m:mean/>
		  <m:apply>
		    <m:apply>
		      <m:times/>
		      <m:ci>x</m:ci>
		      <m:ci>y</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
		<m:apply>
		  <m:times/>
		  <m:apply>  <!-- Two applies used to separate means -->
		    <m:apply>
		      <m:mean/>
		      <m:ci>x</m:ci>
		    </m:apply>
		  </m:apply>
		  <m:apply>
		    <m:apply>
		      <m:mean/>
		      <m:ci>y</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>

	<equation xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="eq2_cov">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci>
		  <m:msub>
		    <m:mi>σ</m:mi>
		    <m:mrow>
		      <m:mi>x</m:mi>
		      <m:mi>y</m:mi>
		    </m:mrow>
		  </m:msub>
		</m:ci>
	      </m:apply>
	      <m:apply>
		<m:int/>
		<m:bvar>
		  <m:ci>y</m:ci>
		</m:bvar>
		<m:uplimit>
		  <m:infinity/>
		</m:uplimit>
		<m:lowlimit>
		  <m:apply>
		    <m:minus/>
		    <m:infinity/>
		  </m:apply>
		</m:lowlimit>
		<m:apply>
		  <m:int/>
		  <m:bvar>
		    <m:ci>x</m:ci>
		  </m:bvar>
		  <m:uplimit>
		    <m:infinity/>
		  </m:uplimit>
		  <m:lowlimit>
		    <m:apply>
		      <m:minus/>
		      <m:infinity/>
		    </m:apply>
		  </m:lowlimit>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:minus/>
		      <m:ci>X</m:ci>
		      <m:apply>
			<m:mean/>
			<m:ci>X</m:ci>
		      </m:apply>
		    </m:apply>
		    <m:apply>
		      <m:minus/>
		      <m:ci>Y</m:ci>
		      <m:apply>
			<m:mean/>
			<m:ci>Y</m:ci>
		      </m:apply>
		    </m:apply>
		    <m:apply>
		      <m:ci type="fn">f</m:ci>
		      <m:ci>x</m:ci>
		      <m:ci>y</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>
      </para>

      <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="cov_sub1">
	<name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Useful Properties</name>
	
	<list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="l_cov">

	  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    If <m:math><m:ci>X</m:ci></m:math> and
	    <m:math><m:ci>Y</m:ci></m:math> are independent and
	    uncorrelated or one of them has zero mean value, then
	    <m:math display="block">
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci>
		    <m:msub>
		      <m:mi>σ</m:mi>
		      <m:mrow>
			<m:mi>x</m:mi>
			<m:mi>y</m:mi>
		      </m:mrow>
		    </m:msub>
		  </m:ci>
		</m:apply>
		<m:cn>0</m:cn>
	      </m:apply>
	    </m:math>
	  </item>

	  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    If  <m:math><m:ci>X</m:ci></m:math> and
	    <m:math><m:ci>Y</m:ci></m:math> are orthogonal, then
	    
	     <m:math display="block">
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci>
		    <m:msub>
		      <m:mi>σ</m:mi>
		      <m:mrow>
			<m:mi>x</m:mi>
			<m:mi>y</m:mi>
		      </m:mrow>
		    </m:msub>
		  </m:ci>
		</m:apply>
		<m:apply>
		  <m:minus/>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#expectedvalue"/>
		      <m:ci>X</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#expectedvalue"/>
		      <m:ci>Y</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:math>
	  </item>
	  
	  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    The covariance is symmetric	    
	    <m:math display="block">
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci type="fn">cov</m:ci>
		  <m:ci>X</m:ci>
		  <m:ci>Y</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci type="fn">cov</m:ci>
		  <m:ci>Y</m:ci>
		  <m:ci>X</m:ci>
		</m:apply>
	      </m:apply>
	    </m:math>	    
	  </item>

	  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    Basic covariance identity
	    <m:math display="block">
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci type="fn">cov</m:ci>
		  <m:apply>
		    <m:plus/>
		    <m:ci>X</m:ci>
		    <m:ci>Y</m:ci>
		  </m:apply>
		  <m:ci>Z</m:ci>
		</m:apply>
		<m:apply>
		  <m:plus/>
		  <m:apply>
		    <m:ci type="fn">cov</m:ci>
		    <m:ci>X</m:ci>
		    <m:ci>Z</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci type="fn">cov</m:ci>
		    <m:ci>Y</m:ci>
		    <m:ci>Z</m:ci>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:math>	
	  </item>

	  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    Covariance of equal variables
	    <m:math display="block">
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci type="fn">cov</m:ci>
		  <m:ci>X</m:ci>
		  <m:ci>X</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci type="fn">Var</m:ci>
		  <m:ci>X</m:ci>
		</m:apply>
	      </m:apply>
	    </m:math>	  
	  </item>

	</list>
	
      </section>
    </section>
    
    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="corr">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Correlation</name>
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="p1_corr">
	For anyone who has any kind of statistical background, you
	should be able to see that the idea of dependence/independence
	among variables and signals plays an important role when
	dealing with random processes.  Because of this, the
	<term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">correlation</term> of two variables provides us with a
	measure of how the two variables affect one another.

	<definition xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="def_corr">
	  <term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Correlation</term>
	  <meaning xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    A measure of how much one random variable depends upon the
	    other.
	  </meaning>
	</definition>
	
	This measure of association between the variables will provide
	us with a clue as to how well the value of one variable can be
	predicted from the value of the other.  The correlation is
	equal to the average of the product of two random variables
	and is defined as

	<equation xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="eq_cor">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="fn">cor</m:ci>
		<m:ci>X</m:ci>
		<m:ci>Y</m:ci>
	      </m:apply>
	      <m:apply>
		<m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#expectedvalue"/>
		<m:apply>
		  <m:times/>
		  <m:ci>X</m:ci>
		  <m:ci>Y</m:ci>
		</m:apply>
	      </m:apply>
	      <m:apply>
		<m:int/>
		<m:bvar>
		  <m:ci>y</m:ci>
		</m:bvar>
		<m:uplimit>
		  <m:infinity/>
		</m:uplimit>
		<m:lowlimit>
		  <m:apply>
		    <m:minus/>
		    <m:infinity/>
		  </m:apply>
		</m:lowlimit>
		<m:apply>
		  <m:int/>
		  <m:bvar>
		    <m:ci>x</m:ci>
		  </m:bvar>
		  <m:uplimit>
		    <m:infinity/>
		  </m:uplimit>
		  <m:lowlimit>
		    <m:apply>
		      <m:minus/>
		      <m:infinity/>
		    </m:apply>
		  </m:lowlimit>
		  <m:apply>
		    <m:times/>
		    <m:ci>x</m:ci>
		    <m:ci>y</m:ci>
		    <m:apply>
		      <m:ci type="fn">f</m:ci>
		      <m:ci>x</m:ci>
		      <m:ci>y</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>
      </para>

      <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="cor_sub1">
	<name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Correlation Coefficient</name>
	<para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="p1_s1">
	  It is often useful to express the correlation of random
	  variables with a range of numbers, like a percentage.  For a
	  given set of variables, we use the <term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">correlation
	  coefficient</term> to give us the linear relationship
	  between our variables.  The correlation coefficient of two
	  variables is defined in terms of their covariance and <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" document="m10656" target="std" strength="8">standard
	  deviations</cnxn>, denoted by
	  <m:math display="inline">
	    <m:apply>
	      <m:ci>
		<m:msub>
		  <m:mi>σ</m:mi>
		  <m:mi>x</m:mi>
		</m:msub>
	      </m:ci>
	    </m:apply>
	  </m:math>, as seen below
	  
	  <equation xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="eq2_cor">
	    <m:math>
	      <m:apply>
		<m:eq/>
		<m:ci>ρ</m:ci>
		<m:apply>
		  <m:divide/>
		  <m:apply>
		    <m:ci type="fn">cov</m:ci>
		    <m:ci>X</m:ci>
		    <m:ci>Y</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:ci>
			<m:msub>
			  <m:mi>σ</m:mi>
			  <m:mi>x</m:mi>
			</m:msub>
		      </m:ci>
		    </m:apply>
		    <m:apply>
		      <m:ci>
			<m:msub>
			  <m:mi>σ</m:mi>
			  <m:mi>y</m:mi>
			</m:msub>
		      </m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:math>
	  </equation>
	  
	  where we will always have 

	  <m:math display="block">
	    <m:apply>
	      <m:leq/>
	      <m:apply>
		<m:leq/>
		<m:cn>-1</m:cn>
		<m:ci>ρ</m:ci>
	      </m:apply>
	      <m:cn>1</m:cn>
	    </m:apply>
	  </m:math>

	  This provides us with a quick and easy way to view the
	  correlation between our variables.  If there is no
	  relationship between the variables then the correlation
	  coefficient will be zero and if there is a perfect positive
	  match it will be one.  If there is a perfect inverse
	  relationship, where one set of variables increases while the
	  other decreases, then the correlation coefficient will be
	  negative one.  This type of correlation is often referred to
	  more specifically as the <term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Pearson's Correlation
	  Coefficient</term>,or Pearson's Product Moment Correlation.
	</para>

	
	<figure xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" orient="horizontal" id="fig_corr">
	  <subfigure xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="subfig1">
	    <media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="image/png" src="corr_inc.png"/>
	    <caption xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      Positive Correlation
	    </caption>
	  </subfigure>
	  <subfigure xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="subfig2">
	    <media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="image/png" src="corr_dec.png"/>
	    <caption xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      Negative Correlation
	    </caption>
	  </subfigure>
	  <subfigure xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="subfig3">
	    <media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="image/png" src="corr_unc.png"/>
	    <caption xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      Uncorrelated (No Correlation)
	    </caption>
	  </subfigure>
	  <caption xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    Types of Correlation
	  </caption>
	</figure>

      </section>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="p33">
	<note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="note">
	  So far we have dealt with correlation simply as a number
	  relating the relationship between any two variables.
	  However, since our goal will be to relate random processes
	  to each other, which deals with signals as a function of
	  time, we will want to continue this study by looking at
	  <term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/"><cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" document="m10676" strength="8">correlation
	  functions</cnxn></term>.
	</note>
      </para>
    </section>

    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="example">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Example</name>
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="p1_eg">
	Now let us take just a second to look at a simple example that
	involves calculating the covariance and correlation of two
	sets of random numbers.  We are given the following data sets:

	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:ci>x</m:ci>
	    <m:apply>
	      <m:set>
		<m:cn>3</m:cn>
		<m:cn>1</m:cn>
		<m:cn>6</m:cn>
		<m:cn>3</m:cn>
		<m:cn>4</m:cn>
	      </m:set>
	    </m:apply>
	  </m:apply>
	</m:math>

	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:ci>y</m:ci>
	    <m:apply>
	      <m:set>
		<m:cn>1</m:cn>
		<m:cn>5</m:cn>
		<m:cn>3</m:cn>
		<m:cn>4</m:cn>
		<m:cn>3</m:cn>
	      </m:set>
	    </m:apply>
	  </m:apply>
	</m:math>

	To begin with, for the covariance we will need to find the
	<cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" document="m10656" strength="8">expected value</cnxn>, or
	mean, of <m:math><m:ci>x</m:ci></m:math> and
	<m:math><m:ci>y</m:ci></m:math>.

	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:mean/>
	      <m:ci>x</m:ci>
	    </m:apply>
	    <m:apply>
	      <m:times/>
	      <m:apply>
		<m:divide/>
		<m:cn>1</m:cn>
		<m:cn>5</m:cn>
	      </m:apply>
	      <m:apply>
		<m:plus/>
		<m:cn>3</m:cn>
		<m:cn>1</m:cn>
		<m:cn>6</m:cn>
		<m:cn>3</m:cn>
		<m:cn>4</m:cn>
	      </m:apply>
	    </m:apply>
	    <m:cn>3.4</m:cn>
	  </m:apply>
	</m:math>

	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:mean/>
	      <m:ci>y</m:ci>
	    </m:apply>
	    <m:apply>
	      <m:times/>
	      <m:apply>
		<m:divide/>
		<m:cn>1</m:cn>
		<m:cn>5</m:cn>
	      </m:apply>
	      <m:apply>
		<m:plus/>
		<m:cn>1</m:cn>
		<m:cn>5</m:cn>
		<m:cn>3</m:cn>
		<m:cn>4</m:cn>
		<m:cn>3</m:cn>
	      </m:apply>
	    </m:apply>
	    <m:cn>3.2</m:cn>
	  </m:apply>
	</m:math>

	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:mean/>
	      <m:apply>
		<m:times/>
		<m:ci>x</m:ci>
		<m:ci>y</m:ci>
	      </m:apply>
	    </m:apply>
	    <m:apply>
	      <m:times/>
	      <m:apply>
		<m:divide/>
		<m:cn>1</m:cn>
		<m:cn>5</m:cn>
	      </m:apply>
	      <m:apply>
		<m:plus/>
		<m:cn>3</m:cn>
		<m:cn>5</m:cn>
		<m:cn>18</m:cn>
		<m:cn>12</m:cn>
		<m:cn>12</m:cn>
	      </m:apply>
	    </m:apply>
	    <m:cn>10</m:cn>
	  </m:apply>
	</m:math>

	Next we will solve for the standard deviations of our two sets
	using the formula below (for a review <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" document="m10656" target="var" strength="8">click here</cnxn>).

	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:ci>σ</m:ci>
	    <m:apply>
	      <m:root/>
	      <m:apply>
		<m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#expectedvalue"/>
		<m:apply>
		  <m:power/>
		  <m:apply>
		    <m:minus/>
		    <m:ci>X</m:ci>
		    <m:apply>
		      <m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#expectedvalue"/>
		      <m:ci>X</m:ci>
		    </m:apply>
		  </m:apply>
		  <m:cn>2</m:cn>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:apply>
	</m:math>
	
	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:ci>
		<m:msub>
		  <m:mi>σ</m:mi>
		  <m:mi>x</m:mi>
		</m:msub>
	      </m:ci>
	    </m:apply>
	    <m:apply>
	      <m:root/>
	      <m:apply>
		<m:times/>
		<m:apply>
		  <m:divide/>
		  <m:cn>1</m:cn>
		  <m:cn>5</m:cn>
		</m:apply>
		<m:apply>
		  <m:plus/>
		  <m:cn>0.16</m:cn>
		  <m:cn>5.76</m:cn>
		  <m:cn>6.76</m:cn>
		  <m:cn>0.16</m:cn>
		  <m:cn>0.36</m:cn>
		</m:apply>
	      </m:apply>
	    </m:apply>
	    <m:cn>1.625</m:cn>
	  </m:apply>
	</m:math>

	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:ci>
		<m:msub>
		  <m:mi>σ</m:mi>
		  <m:mi>y</m:mi>
		</m:msub>
	      </m:ci>
	    </m:apply>
	    <m:apply>
	      <m:root/>
	      <m:apply>
		<m:times/>
		<m:apply>
		  <m:divide/>
		  <m:cn>1</m:cn>
		  <m:cn>6</m:cn>
		</m:apply>
		<m:apply>
		  <m:plus/>
		  <m:cn>4.84</m:cn>
		  <m:cn>3.24</m:cn>
		  <m:cn>0.04</m:cn>
		  <m:cn>0.64</m:cn>
		  <m:cn>0.04</m:cn>
		</m:apply>
	      </m:apply>
	    </m:apply>
	    <m:cn>1.327</m:cn>
	  </m:apply>
	</m:math>

	Now we can finally calculate the covariance using one of the
	two formulas found above.  Since we calculated the three
	means, we will use that <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="eqa_cov" strength="7">formula</cnxn> since it will be much simpler.

	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:ci>
		<m:msub>
		  <m:mi>σ</m:mi>
		  <m:mrow>
		    <m:mi>x</m:mi>
		    <m:mi>y</m:mi>
		  </m:mrow>
		</m:msub>
	      </m:ci>
	    </m:apply>
	    <m:apply>
	      <m:minus/>
	      <m:cn>10</m:cn>
	      <m:apply>
		<m:times/>
		<m:cn>3.4</m:cn>
		<m:cn>3.2</m:cn>
	      </m:apply>
	    </m:apply>
	    <m:cn>-0.88</m:cn>
	  </m:apply>
	</m:math>
	    
	And for our last calculation, we will solve for the
	correlation coefficient, <m:math><m:ci>ρ</m:ci></m:math>.

	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:ci>ρ</m:ci>
	    <m:apply>
	      <m:divide/>
	      <m:cn>-0.88</m:cn>
	      <m:apply>
		<m:times/>
		<m:cn>1.625</m:cn>
		<m:cn>1.327</m:cn>
	      </m:apply>
	    </m:apply>
	    <m:cn>-0.408</m:cn>
	  </m:apply>
	</m:math>
      </para>
      
      <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="eg_code">
	<name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Matlab Code for Example</name>
	<para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="p34">
	  The above example can be easily calculated using Matlab.
	  Below I have included the code to find all of the values
	  above.
	</para>
	
	<code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="block" id="forloopexample">
	  <![CDATA[	
	  x = [3 1 6 3 4];
	  y = [1 5 3 4 3];

	  mx = mean(x)
	  my = mean(y)
	  mxy = mean(x.*y)
	  
	  % Standard Dev. from built-in Matlab Functions
	  std(x,1)
	  std(y,1)

	  % Standard Dev. from Equation Above (same result as std(?,1))
	  sqrt( 1/5 * sum((x-mx).^2))  
	  sqrt( 1/5 * sum((y-my).^2))

	  cov(x,y,1)

	  corrcoef(x,y)
	  ]]>

	</code>

      </section>

    </section>
      
  </content>
</document>
