Yesterday I asked for advice on generating a sample
from a multi(5)variate distribution with a given
covariance structure with 4 of the 5 variables having
a normal distribution and the 5th having a Gumbel
distribution. Roy W. Haas gave me the following
solution:
> You can always use the following two-step process.
> Let X be the (standard) normal variable that you
> want to change the marginal distribution of. Then
> U=F(X), where F() is the standard normal cdf, has a
> uniform distribution. Then Y=G*(U) has the
> cumulative distribution G(), where G* is the inverse
> function of G. You may have to approximate the
> covariance between Y and the other marginals by a
> series expansion or similar device, but you now have
> the desired marginal distribution.
Here's my interpretation of Roy's advice ("sigma" is
the target var-cov matrix) :
*****START oF CODE*****************
mat corsigma=corr(sigma)
drawnorm z1 z2 z3 z4 z5,corr(corsigma)
gen u5=norm(z5) /*transformation to uniform*/
gen g=log(log(1/(1-u5))) /*transformation to Gumbel
with parameters a=0 and b=1*/
mat diagsigma=vecdiag(sigma)
gen a0i=z1*sqrt(diagsigma[1,1])
gen a1i=z2*sqrt(diagsigma[1,2])
gen b0i=z3*sqrt(diagsigma[1,3])
gen b1i=z4*sqrt(diagsigma[1,4])
gen c0i=g*sqrt(diagsigma[1,5])/sqrt(1.645)
/* 1.645 is the variance of a Gumbel(0,1)*/
**************END OF CODE***********************
This method seems to work OK. If Roy or someone else
wants to comment on this is wellcome.
Thanks again Roy.
Nikos Pantazis
Biostatistician
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/