<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/174179</link>
    <title>MATLAB Central Newsreader - Generation of Correlated Data</title>
    <description>Feed for thread: Generation of Correlated Data</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 12 Aug 2008 08:39:01 -0400</pubDate>
      <title>Generation of Correlated Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/174179#448667</link>
      <author>Deva MDP</author>
      <description>Can some one tell how to generate two random data sets &lt;br&gt;
with known correlation, (say Corr. Coef. = 0.5)</description>
    </item>
    <item>
      <pubDate>Tue, 12 Aug 2008 15:26:01 -0400</pubDate>
      <title>Re: Generation of Correlated Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/174179#448705</link>
      <author>Roger Stafford</author>
      <description>&quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message &amp;lt;g7ri75$8hr&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Can some one tell how to generate two random data sets &lt;br&gt;
&amp;gt; with known correlation, (say Corr. Coef. = 0.5)&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Generate any two mutually independent variables, x and y, whose means are &lt;br&gt;
0 and variances 1.  For example x = randn(n,1) and y = randn(n,1).  Then we &lt;br&gt;
have&lt;br&gt;
&lt;br&gt;
&amp;nbsp;E(x) = E(y) = 0,&lt;br&gt;
&amp;nbsp;E(x^2) = E(y^2) = 1&lt;br&gt;
&amp;nbsp;E(x*y) = E(x)*E(y) = 0&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Then construct z = x + k*y where k is some constant yet to be determined.  &lt;br&gt;
Now we have&lt;br&gt;
&lt;br&gt;
&amp;nbsp;E(z) = 0,&lt;br&gt;
&amp;nbsp;E(z^2) = E(x^2) + 2*k*E(x*y) + k^2*E(y^2) = 1 + k^2,&lt;br&gt;
&amp;nbsp;E(x*z) = E(x^2) + k*E(x*y) = 1&lt;br&gt;
&lt;br&gt;
Hence&lt;br&gt;
&lt;br&gt;
&amp;nbsp;corr(x,z) = E(x*z)/sqrt(E(x^2)*E(z^2)) = 1/sqrt(1+k^2)&lt;br&gt;
&lt;br&gt;
Therefore solve for the value of k that gives you the desired correlation &lt;br&gt;
coefficient.  For corr = .5 it would be k = sqrt(3).&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Are you sure you don't have further requirements?  You have left a lot of &lt;br&gt;
freedom in your description here.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Mon, 15 Sep 2008 07:13:02 -0400</pubDate>
      <title>Re: Generation of Correlated Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/174179#600331</link>
      <author>Deva MDP</author>
      <description>&quot;Roger Stafford&quot; &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in message &amp;lt;g88cr6$d72$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message &amp;lt;g885b5$m3v&lt;br&gt;
&amp;gt; $1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;g7ri75$8hr$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Can some one tell how to generate two random data sets &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; with known correlation, (say Corr. Coef. = 0.5)&lt;br&gt;
&amp;gt; &amp;gt; devasiri@gmail.com&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Dear Friend,&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thank you for the support given. I undestood how to generate&lt;br&gt;
&amp;gt; &amp;gt; two data vectors to a required correlatin between them.But&lt;br&gt;
&amp;gt; &amp;gt; my problem is as follows which I couldn't clarify yet.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I have generated a correlated random vector with 3 columns&lt;br&gt;
&amp;gt; &amp;gt; for a desired correlaton matrix. Though my work is&lt;br&gt;
&amp;gt; &amp;gt; successful, still I don't know the theory behind this procedure.&lt;br&gt;
&amp;gt; &amp;gt; The procedure adopted is as follows.&lt;br&gt;
&amp;gt; &amp;gt;  &lt;br&gt;
&amp;gt; &amp;gt; (1) Generated 3 random vectors with ndependently normally&lt;br&gt;
&amp;gt; &amp;gt; dstributed entries. X=[x1 x2 x3]&lt;br&gt;
&amp;gt; &amp;gt; Corr(X)= Identity matrix approximately.&lt;br&gt;
&amp;gt; &amp;gt;  &lt;br&gt;
&amp;gt; &amp;gt; (2) Then x is transformed in to Y by Y=X*c , where c=&lt;br&gt;
&amp;gt; &amp;gt; squreroot of G (G s the ultimate correlation matrix of Y)&lt;br&gt;
&amp;gt; &amp;gt; (c is +ve definte matrx)&lt;br&gt;
&amp;gt; &amp;gt; The form of G = (1 g g;g 1 g;g g 1], g is the correlaton&lt;br&gt;
&amp;gt; &amp;gt; between the formed vectors.&lt;br&gt;
&amp;gt; &amp;gt;  &lt;br&gt;
&amp;gt; &amp;gt; Thankful If you can kndly let me know the theory behind this&lt;br&gt;
&amp;gt; &amp;gt; procedure.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Best regards&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Devasiri&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   For the sake of discussion suppose that your three independent normally &lt;br&gt;
&amp;gt; distributed random variables x1, x2, and x3 have mean 0 and variance 1, so &lt;br&gt;
&amp;gt; that correlation and covariance are one and the same.  If c is the matrix &lt;br&gt;
&amp;gt; square root of the G you have defined, then the following holds true.  The &lt;br&gt;
&amp;gt; covariance matrix of your n by 3 matrix Y = X*c is given by&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  E{Y'*Y} = E{(X*c)'*(X*c)} = E{c'*X'*X*c}&lt;br&gt;
&amp;gt;  = c'*E{X'*X}*c = c'*I*c = c'*c = c*c = G&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Here I is the identity matrix for the covariance matrix of X, and c = c' because &lt;br&gt;
&amp;gt; it is symmetric.  Thus Y has the desired covariances.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   Note that the same would be true for any positive definite G.  All you have to &lt;br&gt;
&amp;gt; do is find its matrix square root (using eigenvector methods presumably.)&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; Dear Roger,&lt;br&gt;
&lt;br&gt;
I have already generated the required correlated data sets. &lt;br&gt;
using C=sqrtm(g). y=X*C, Also I undestand what you explaind to me previously. &lt;br&gt;
&lt;br&gt;
But, still I am suffering with the proof of Corr(Y)= G,  (here, C'*C=G, C= symmetric, + semidefinite matrix), &lt;br&gt;
I can prove Corr(x)=I (Identity matrix)&lt;br&gt;
since Corr(X*C)= Corr(X)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I do not get Corr(Y)=G.&lt;br&gt;
Please help me to prove this&lt;br&gt;
I need this theorey to include it in my methodology.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Thank you very much.&lt;br&gt;
Devasiri</description>
    </item>
    <item>
      <pubDate>Tue, 16 Sep 2008 08:40:04 -0400</pubDate>
      <title>Re: Generation of Correlated Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/174179#600524</link>
      <author>Deva MDP</author>
      <description>&quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message &amp;lt;gal1tu$2ha$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Roger Stafford&quot; &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in message &amp;lt;g88cr6$d72$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message &amp;lt;g885b5$m3v&lt;br&gt;
&amp;gt; &amp;gt; $1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;lt;g7ri75$8hr$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Can some one tell how to generate two random data sets &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; with known correlation, (say Corr. Coef. = 0.5)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; devasiri@gmail.com&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Dear Friend,&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Thank you for the support given. I undestood how to generate&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; two data vectors to a required correlatin between them.But&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; my problem is as follows which I couldn't clarify yet.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I have generated a correlated random vector with 3 columns&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; for a desired correlaton matrix. Though my work is&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; successful, still I don't know the theory behind this procedure.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; The procedure adopted is as follows.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;  &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; (1) Generated 3 random vectors with ndependently normally&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; dstributed entries. X=[x1 x2 x3]&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Corr(X)= Identity matrix approximately.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;  &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; (2) Then x is transformed in to Y by Y=X*c , where c=&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; squreroot of G (G s the ultimate correlation matrix of Y)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; (c is +ve definte matrx)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; The form of G = (1 g g;g 1 g;g g 1], g is the correlaton&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; between the formed vectors.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;  &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Thankful If you can kndly let me know the theory behind this&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; procedure.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Best regards&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Devasiri&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;   For the sake of discussion suppose that your three independent normally &lt;br&gt;
&amp;gt; &amp;gt; distributed random variables x1, x2, and x3 have mean 0 and variance 1, so &lt;br&gt;
&amp;gt; &amp;gt; that correlation and covariance are one and the same.  If c is the matrix &lt;br&gt;
&amp;gt; &amp;gt; square root of the G you have defined, then the following holds true.  The &lt;br&gt;
&amp;gt; &amp;gt; covariance matrix of your n by 3 matrix Y = X*c is given by&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;  E{Y'*Y} = E{(X*c)'*(X*c)} = E{c'*X'*X*c}&lt;br&gt;
&amp;gt; &amp;gt;  = c'*E{X'*X}*c = c'*I*c = c'*c = c*c = G&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Here I is the identity matrix for the covariance matrix of X, and c = c' because &lt;br&gt;
&amp;gt; &amp;gt; it is symmetric.  Thus Y has the desired covariances.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;   Note that the same would be true for any positive definite G.  All you have to &lt;br&gt;
&amp;gt; &amp;gt; do is find its matrix square root (using eigenvector methods presumably.)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; &amp;gt; Dear Roger,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have already generated the required correlated data sets. &lt;br&gt;
&amp;gt; using C=sqrtm(g). y=X*C, Also I undestand what you explaind to me previously. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But, still I am suffering with the proof of Corr(Y)= G,  (here, C'*C=G, C= symmetric, + semidefinite matrix), &lt;br&gt;
&amp;gt; I can prove Corr(x)=I (Identity matrix)&lt;br&gt;
&amp;gt; since Corr(X*C)= Corr(X)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I do not get Corr(Y)=G.&lt;br&gt;
&amp;gt; Please help me to prove this&lt;br&gt;
&amp;gt; I need this theorey to include it in my methodology.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you very much.&lt;br&gt;
&amp;gt; Devasiri&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Sun, 17 Aug 2008 03:19:01 -0400</pubDate>
      <title>Re: Generation of Correlated Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/174179#510946</link>
      <author>Deva MDP</author>
      <description>&quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;g7ri75$8hr$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Can some one tell how to generate two random data sets &lt;br&gt;
&amp;gt; with known correlation, (say Corr. Coef. = 0.5)&lt;br&gt;
devasiri@gmail.com&lt;br&gt;
&lt;br&gt;
Dear Friend,&lt;br&gt;
&lt;br&gt;
Thank you for the support given. I undestood how to generate&lt;br&gt;
two data vectors to a required correlatin between them.But&lt;br&gt;
my problem is as follows which I couldn't clarify yet.&lt;br&gt;
&lt;br&gt;
I have generated a correlated random vector with 3 columns&lt;br&gt;
for a desired correlaton matrix. Though my work is&lt;br&gt;
successful, still I don't know the theory behind this procedure.&lt;br&gt;
The procedure adopted is as follows.&lt;br&gt;
&amp;nbsp;&lt;br&gt;
(1) Generated 3 random vectors with ndependently normally&lt;br&gt;
dstributed entries. X=[x1 x2 x3]&lt;br&gt;
Corr(X)= Identity matrix approximately.&lt;br&gt;
&amp;nbsp;&lt;br&gt;
(2) Then x is transformed in to Y by Y=X*c , where c=&lt;br&gt;
squreroot of G (G s the ultimate correlation matrix of Y)&lt;br&gt;
(c is +ve definte matrx)&lt;br&gt;
The form of G = (1 g g;g 1 g;g g 1], g is the correlaton&lt;br&gt;
between the formed vectors.&lt;br&gt;
&amp;nbsp;&lt;br&gt;
Thankful If you can kndly let me know the theory behind this&lt;br&gt;
procedure.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Best regards&lt;br&gt;
&lt;br&gt;
Devasiri</description>
    </item>
    <item>
      <pubDate>Sun, 17 Aug 2008 05:27:02 -0400</pubDate>
      <title>Re: Generation of Correlated Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/174179#510952</link>
      <author>Roger Stafford</author>
      <description>&quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message &amp;lt;g885b5$m3v&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;lt;g7ri75$8hr$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Can some one tell how to generate two random data sets &lt;br&gt;
&amp;gt; &amp;gt; with known correlation, (say Corr. Coef. = 0.5)&lt;br&gt;
&amp;gt; devasiri@gmail.com&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Dear Friend,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you for the support given. I undestood how to generate&lt;br&gt;
&amp;gt; two data vectors to a required correlatin between them.But&lt;br&gt;
&amp;gt; my problem is as follows which I couldn't clarify yet.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have generated a correlated random vector with 3 columns&lt;br&gt;
&amp;gt; for a desired correlaton matrix. Though my work is&lt;br&gt;
&amp;gt; successful, still I don't know the theory behind this procedure.&lt;br&gt;
&amp;gt; The procedure adopted is as follows.&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; (1) Generated 3 random vectors with ndependently normally&lt;br&gt;
&amp;gt; dstributed entries. X=[x1 x2 x3]&lt;br&gt;
&amp;gt; Corr(X)= Identity matrix approximately.&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; (2) Then x is transformed in to Y by Y=X*c , where c=&lt;br&gt;
&amp;gt; squreroot of G (G s the ultimate correlation matrix of Y)&lt;br&gt;
&amp;gt; (c is +ve definte matrx)&lt;br&gt;
&amp;gt; The form of G = (1 g g;g 1 g;g g 1], g is the correlaton&lt;br&gt;
&amp;gt; between the formed vectors.&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; Thankful If you can kndly let me know the theory behind this&lt;br&gt;
&amp;gt; procedure.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Best regards&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Devasiri&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;For the sake of discussion suppose that your three independent normally &lt;br&gt;
distributed random variables x1, x2, and x3 have mean 0 and variance 1, so &lt;br&gt;
that correlation and covariance are one and the same.  If c is the matrix &lt;br&gt;
square root of the G you have defined, then the following holds true.  The &lt;br&gt;
covariance matrix of your n by 3 matrix Y = X*c is given by&lt;br&gt;
&lt;br&gt;
&amp;nbsp;E{Y'*Y} = E{(X*c)'*(X*c)} = E{c'*X'*X*c}&lt;br&gt;
&amp;nbsp;= c'*E{X'*X}*c = c'*I*c = c'*c = c*c = G&lt;br&gt;
&lt;br&gt;
Here I is the identity matrix for the covariance matrix of X, and c = c' because &lt;br&gt;
it is symmetric.  Thus Y has the desired covariances.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Note that the same would be true for any positive definite G.  All you have to &lt;br&gt;
do is find its matrix square root (using eigenvector methods presumably.)&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Sun, 17 Aug 2008 07:26:01 -0400</pubDate>
      <title>Re: Generation of Correlated Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/174179#510958</link>
      <author>Deva MDP</author>
      <description>&quot;Roger Stafford&quot; &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt;&lt;br&gt;
wrote in message &amp;lt;g88cr6$d72$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message &amp;lt;g885b5$m3v&lt;br&gt;
&amp;gt; $1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Deva MDP&quot; &amp;lt;devasiri@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;g7ri75$8hr$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Can some one tell how to generate two random data sets &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; with known correlation, (say Corr. Coef. = 0.5)&lt;br&gt;
&amp;gt; &amp;gt; devasiri@gmail.com&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Dear Friend,&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thank you for the support given. I undestood how to generate&lt;br&gt;
&amp;gt; &amp;gt; two data vectors to a required correlatin between them.But&lt;br&gt;
&amp;gt; &amp;gt; my problem is as follows which I couldn't clarify yet.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; &amp;gt; I have generated a correlated random vector with 3 columns&lt;br&gt;
&amp;gt; &amp;gt; for a desired correlaton matrix. Though my work is&lt;br&gt;
&amp;gt; &amp;gt; successful, still I don't know the theory behind this&lt;br&gt;
procedure.&lt;br&gt;
&amp;gt; &amp;gt; The procedure adopted is as follows.&lt;br&gt;
&amp;gt; &amp;gt;  &lt;br&gt;
&amp;gt; &amp;gt; (1) Generated 3 random vectors with ndependently normally&lt;br&gt;
&amp;gt; &amp;gt; dstributed entries. X=[x1 x2 x3]&lt;br&gt;
&amp;gt; &amp;gt; Corr(X)= Identity matrix approximately.&lt;br&gt;
&amp;gt; &amp;gt;  &lt;br&gt;
&amp;gt; &amp;gt; (2) Then x is transformed in to Y by Y=X*c , where c=&lt;br&gt;
&amp;gt; &amp;gt; squreroot of G (G s the ultimate correlation matrix of Y)&lt;br&gt;
&amp;gt; &amp;gt; (c is +ve definte matrx)&lt;br&gt;
&amp;gt; &amp;gt; The form of G = (1 g g;g 1 g;g g 1], g is the correlaton&lt;br&gt;
&amp;gt; &amp;gt; between the formed vectors.&lt;br&gt;
&amp;gt; &amp;gt;  &lt;br&gt;
&amp;gt; &amp;gt; Thankful If you can kndly let me know the theory behind this&lt;br&gt;
&amp;gt; &amp;gt; procedure.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Best regards&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Devasiri&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   For the sake of discussion suppose that your three&lt;br&gt;
independent normally &lt;br&gt;
&amp;gt; distributed random variables x1, x2, and x3 have mean 0&lt;br&gt;
and variance 1, so &lt;br&gt;
&amp;gt; that correlation and covariance are one and the same.  If&lt;br&gt;
c is the matrix &lt;br&gt;
&amp;gt; square root of the G you have defined, then the following&lt;br&gt;
holds true.  The &lt;br&gt;
&amp;gt; covariance matrix of your n by 3 matrix Y = X*c is given by&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  E{Y'*Y} = E{(X*c)'*(X*c)} = E{c'*X'*X*c}&lt;br&gt;
&amp;gt;  = c'*E{X'*X}*c = c'*I*c = c'*c = c*c = G&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Here I is the identity matrix for the covariance matrix of&lt;br&gt;
X, and c = c' because &lt;br&gt;
&amp;gt; it is symmetric.  Thus Y has the desired covariances.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   Note that the same would be true for any positive&lt;br&gt;
definite G.  All you have to &lt;br&gt;
&amp;gt; do is find its matrix square root (using eigenvector&lt;br&gt;
methods presumably.)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; &lt;br&gt;
Dear Roger,&lt;br&gt;
&lt;br&gt;
Thank you very much for your support.&lt;br&gt;
I can understand that.But I got Corr(A*Y)=Corr(Y)&lt;br&gt;
As I have the above thinking n my mind, still I find dffcult&lt;br&gt;
to undestand the correlation relationship between X and Y&lt;br&gt;
data sets.&lt;br&gt;
&lt;br&gt;
Regards from&lt;br&gt;
&lt;br&gt;
Devasiri </description>
    </item>
    <item>
      <pubDate>Sun, 17 Aug 2008 17:47:31 -0400</pubDate>
      <title>Re: Generation of Correlated Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/174179#510994</link>
      <author>Greg Heath</author>
      <description>On Aug 17, 1:27=A0am, &quot;Roger Stafford&quot;&lt;br&gt;
&amp;lt;ellieandrogerxy...@mindspring.com.invalid&amp;gt; wrote:&lt;br&gt;
&amp;gt; &quot;Deva MDP&quot; &amp;lt;devas...@gmail.com&amp;gt; wrote in message &amp;lt;g885b5$m3v&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; $...@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &quot;Deva MDP&quot; &amp;lt;devas...@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;g7ri75$8h...@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Can some one tell how to generate two random data sets&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; with known correlation, (say Corr. Coef. =3D 0.5)&lt;br&gt;
&amp;gt; &amp;gt; devas...@gmail.com&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Dear Friend,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Thank you for the support given. I undestood how to generate&lt;br&gt;
&amp;gt; &amp;gt; two data vectors to a required correlatin between them.But&lt;br&gt;
&amp;gt; &amp;gt; my problem is as follows which I couldn't clarify yet.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I have generated a correlated random vector with 3 columns&lt;br&gt;
&amp;gt; &amp;gt; for a desired correlaton matrix. Though my work is&lt;br&gt;
&amp;gt; &amp;gt; successful, still I don't know the theory behind this procedure.&lt;br&gt;
&amp;gt; &amp;gt; The procedure adopted is as follows.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; (1) Generated 3 random vectors with ndependently normally&lt;br&gt;
&amp;gt; &amp;gt; dstributed entries. X=3D[x1 x2 x3]&lt;br&gt;
&amp;gt; &amp;gt; Corr(X)=3D Identity matrix approximately.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; (2) Then x is transformed in to Y by Y=3DX*c , where c=3D&lt;br&gt;
&amp;gt; &amp;gt; squreroot of G (G s the ultimate correlation matrix of Y)&lt;br&gt;
&amp;gt; &amp;gt; (c is +ve definte matrx)&lt;br&gt;
&amp;gt; &amp;gt; The form of G =3D (1 g g;g 1 g;g g 1], g is the correlaton&lt;br&gt;
&amp;gt; &amp;gt; between the formed vectors.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Thankful If you can kndly let me know the theory behind this&lt;br&gt;
&amp;gt; &amp;gt; procedure.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Best regards&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Devasiri&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0 For the sake of discussion suppose that your three independent normal=&lt;br&gt;
ly&lt;br&gt;
&amp;gt; distributed random variables x1, x2, and x3 have mean 0 and variance 1, s=&lt;br&gt;
o&lt;br&gt;
&amp;gt; that correlation and covariance are one and the same. =A0If c is the matr=&lt;br&gt;
ix&lt;br&gt;
&amp;gt; square root of the G you have defined, then the following holds true. =A0=&lt;br&gt;
The&lt;br&gt;
&amp;gt; covariance matrix of your n by 3 matrix Y =3D X*c is given by&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0E{Y'*Y} =3D E{(X*c)'*(X*c)} =3D E{c'*X'*X*c}&lt;br&gt;
&amp;gt; =A0=3D c'*E{X'*X}*c =3D c'*I*c =3D c'*c =3D c*c =3D G&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Here I is the identity matrix for the covariance matrix of X, and c =3D c=&lt;br&gt;
' because&lt;br&gt;
&amp;gt; it is symmetric. =A0Thus Y has the desired covariances.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0 Note that the same would be true for any positive definite G. =A0All =&lt;br&gt;
you have to&lt;br&gt;
&amp;gt; do is find its matrix square root (using eigenvector methods presumably.)&lt;br&gt;
&lt;br&gt;
The matrix square root is obviously not unique. Why do you prefer&lt;br&gt;
using eigenvector methods instead of SQRTM?&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Sun, 17 Aug 2008 21:48:01 -0400</pubDate>
      <title>Re: Generation of Correlated Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/174179#575322</link>
      <author>Roger Stafford</author>
      <description>Greg Heath &amp;lt;heath@alumni.brown.edu&amp;gt; wrote in message &lt;br&gt;
&amp;lt;193fc757-3622-4faa-b8ee-&lt;br&gt;
abf2fa117d70@p25g2000hsf.googlegroups.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
&amp;gt; The matrix square root is obviously not unique.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;The square root of a positive definite matrix plays essentially the same role of &lt;br&gt;
uniqueness in matrix theory as does the square root of a positive scalar number &lt;br&gt;
in the real continuum.  To partially quote Mathworks, it &quot;is the principal square &lt;br&gt;
root of the matrix ... the unique square root for which every eigenvalue has &lt;br&gt;
nonnegative real part.&quot;&lt;br&gt;
&lt;br&gt;
&amp;gt; Why do you prefer using eigenvector methods instead of SQRTM?&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;As you must be fully aware, Greg, the matlab function 'sqrtm' does in fact use &lt;br&gt;
eigenvector methods.  It is an excellent way of finding a matrix principal square &lt;br&gt;
root.  It is not a question of &quot;instead of&quot;.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
  </channel>
</rss>

