Path: news.mathworks.com!not-for-mail From: "Deva MDP" <devasiri@gmail.com> Newsgroups: comp.soft-sys.matlab Subject: Re: Generation of Correlated Data Date: Tue, 16 Sep 2008 08:40:04 +0000 (UTC) Organization: Finnroad Lines: 75 Message-ID: <ganrd4$cnu$1@fred.mathworks.com> References: <g7ri75$8hr$1@fred.mathworks.com> <g885b5$m3v$1@fred.mathworks.com> <g88cr6$d72$1@fred.mathworks.com> <gal1tu$2ha$1@fred.mathworks.com> Reply-To: "Deva MDP" <devasiri@gmail.com> NNTP-Posting-Host: webapp-02-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1221554404 13054 172.30.248.37 (16 Sep 2008 08:40:04 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Tue, 16 Sep 2008 08:40:04 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1443886 Xref: news.mathworks.com comp.soft-sys.matlab:490434 "Deva MDP" <devasiri@gmail.com> wrote in message <gal1tu$2ha$1@fred.mathworks.com>... > "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <g88cr6$d72$1@fred.mathworks.com>... > > "Deva MDP" <devasiri@gmail.com> wrote in message <g885b5$m3v > > $1@fred.mathworks.com>... > > > "Deva MDP" <devasiri@gmail.com> wrote in message > > > <g7ri75$8hr$1@fred.mathworks.com>... > > > > Can some one tell how to generate two random data sets > > > > with known correlation, (say Corr. Coef. = 0.5) > > > devasiri@gmail.com > > > > > > Dear Friend, > > > > > > Thank you for the support given. I undestood how to generate > > > two data vectors to a required correlatin between them.But > > > my problem is as follows which I couldn't clarify yet. > > > > > > I have generated a correlated random vector with 3 columns > > > for a desired correlaton matrix. Though my work is > > > successful, still I don't know the theory behind this procedure. > > > The procedure adopted is as follows. > > > > > > (1) Generated 3 random vectors with ndependently normally > > > dstributed entries. X=[x1 x2 x3] > > > Corr(X)= Identity matrix approximately. > > > > > > (2) Then x is transformed in to Y by Y=X*c , where c= > > > squreroot of G (G s the ultimate correlation matrix of Y) > > > (c is +ve definte matrx) > > > The form of G = (1 g g;g 1 g;g g 1], g is the correlaton > > > between the formed vectors. > > > > > > Thankful If you can kndly let me know the theory behind this > > > procedure. > > > > > > Best regards > > > > > > Devasiri > > > > For the sake of discussion suppose that your three independent normally > > distributed random variables x1, x2, and x3 have mean 0 and variance 1, so > > that correlation and covariance are one and the same. If c is the matrix > > square root of the G you have defined, then the following holds true. The > > covariance matrix of your n by 3 matrix Y = X*c is given by > > > > E{Y'*Y} = E{(X*c)'*(X*c)} = E{c'*X'*X*c} > > = c'*E{X'*X}*c = c'*I*c = c'*c = c*c = G > > > > Here I is the identity matrix for the covariance matrix of X, and c = c' because > > it is symmetric. Thus Y has the desired covariances. > > > > Note that the same would be true for any positive definite G. All you have to > > do is find its matrix square root (using eigenvector methods presumably.) > > > > > > Roger Stafford > > Dear Roger, > > I have already generated the required correlated data sets. > using C=sqrtm(g). y=X*C, Also I undestand what you explaind to me previously. > > But, still I am suffering with the proof of Corr(Y)= G, (here, C'*C=G, C= symmetric, + semidefinite matrix), > I can prove Corr(x)=I (Identity matrix) > since Corr(X*C)= Corr(X) > > > I do not get Corr(Y)=G. > Please help me to prove this > I need this theorey to include it in my methodology. > > > Thank you very much. > Devasiri >