Date: Wed, 1 Aug 2001 11:05:06 +0100 Carlos Tadeu "SAS(r) Discussion" Carlos Tadeu Re: SAS code to generate data using specified variance-covariance matrix multipart/alternative;

I tried to make something similar in my thesis. I did not obtain many advance but I obtained to generate some correlated marginal distributions. As example: the uniform, triangular, exponential, gamma and binomial. These results had not been still published and if someone know where I can present it (e.g. SAS journal), please let me know. Thanks Carlos Tadeu

"Dale McLerran" <dmclerra@MY-DEJA.COM> wrote in message news:200107311705.KAA12409@mail16.bigmailbox.com... > Hongjie, > > I don't think that you will find such a macro for this reason: you > request a macro which will generate variables with specified mean and > covariance structure for distributions which are not normal. Of > course, you are also including in your request a macro which would > generate variables from the normal distribution. But we need to focus > on the part of your request which makes it virtually impossible to > achieve. > > To show the problem, let's start with the method for generating data > from a normal distribution with specific mean and covariance. We > begin by generating data from independent random normal distributions. > Suppose that we call this data X. Now, in order to return data with > a specific covariance structure, we first decompose the covariance > matrix to obtain a "square root" of the covariance. That is, we find > a matrix U such that U'U=Cov. Note that there are a couple of such > matrices which we can obtain. Using the ROOT function (Cholesky > decomposition), you can obtain U such that U is upper triangular (all > zero values below the diagonal). Using the singular value decomposition, > you can obtain U such that U=U'. I prefer the singular value > decomposition myself, though it should not matter too much which you > choose. Now that you have the "square root" of the covariance matrix > and a set of normally distributed variables which are generated > independently (X ~ iid N(0,I(k)) where I(k) is an identity matrix), > then the matrix Y ~ N(mu, Cov) can be obtained through > > Y = XU + mu > > That is, Y is obtained as a linear combination of the columns of X. > > > Now, a linear combination of normally distributed variates is itself > normally distributed. Most distributions, however, do not have this > propagation property. That is, a linear combination of Uniform(a,b) > r.v.'s will not have a distribution which is Uniform. Nor will some > variates independently distributed as chi-square have a chi-square > distribution for the linear combination. The absence of this > propagation property for other distributions makes it exceedingly > difficult to generate correlated covariates from distributions which > are not normal. If you find a general solution to this problem for > nonnormal variates, I would be very interested to see how that is > obtained. Almost surely, it would be very computationally intensive. > > Dale > > > >Date: Mon, 30 Jul 2001 20:51:28 -0400 > >Reply-To: Hongjie Wang <HWang@CYBERDIALOGUE.COM> > > Hongjie Wang <HWang@CYBERDIALOGUE.COM> SAS-L@LISTSERV.UGA.EDU > >I wonder if there are macro codes out there that does the following: > > > > > >Inputs: Number of variables, variance-covariance matrix, Number of > >Observations, Distributions, Mean vectors, > >Ouputs: A data matrix. > > > >Thanks. > >Hongjie > > > > > --------------------------------------- > Dale McLerran > Fred Hutchinson Cancer Research Center > mailto: dmclerra@fhcrc.org > Ph: (206) 667-2926 > Fax: (206) 667-5977 > --------------------------------------- > > ------------------------------------------------------------ > --== Sent via Deja.com ==-- > http://www.deja.com/ >

[text/html]

Back to: Top of message | Previous page | Main SAS-L page